

We will have the remote-tracking branch reference origin/master and the local master branch reference pointing at commit point C. Suppose we cloned a remote repository having three commits.Let's try to understand this difference better and the use of remote-tracking branches with the help of the following illustration. Git Fetch can be considered as a harmless option as our working branch is not altered and our uncommitted work is secure.

#Git fetch vs pull origin download#
So internally Git Pull first calls the Git Fetch command to download the content from remote repositories to the local repository and then calls the Git Merge command to add these changes to the local working branch. Git Pull combines the working of two different Git Commands - Git Fetch and Git Merge. It updates the remote-tracking branch to make sure that we can see the changes but still keep our local working branch intact. Git Fetch is a command which just copies or downloads content from the remote repository into the local repository.Īfter pulling we will have a branch that has the local commits as well as the new commits that were added to the remote repository. Git Pull downloads the content from the remote repository and also merges the new commits into our working branch. In this article, we'll see some key differences between them. Git Pull integrates the working of two different commands and one of those commands is Git Fetch. Git Fetch and Git Pull commands are both used to download content from a remote repository to our local repository.
