xxxxxxxxxx
Git Fetch ==>The Git Fetch command
downloads commits, files from a remote
repository into your local repo.
Fetching is what you do when you want
to see what everybody else has been working on
Git Pull ==> fetch and merge any
commits from the remote branch
xxxxxxxxxx
git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn’t do any file transferring. It’s more like just checking to see if there are any changes available).
git pull on the other hand does that AND brings (copy) those changes from the remote repository.
xxxxxxxxxx
Git Fetch is the command that tells the local repository that there are
changes available in the remote repository without bringing the changes
into the local repository.
Git Pull on the other hand brings the copy of the remote directory
changes into the local repository.
xxxxxxxxxx
In the simplest terms, git pull does a git fetch followed by a git merge.
You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn't recommend doing this).
A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.
From the Git documentation for git pull:
In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.
xxxxxxxxxx
Git pull command pulls new changes or commits from a particular branch from your central repository and updates your target branch in your local repository.
Git fetch is also used for the same purpose but it works in a slightly different way. When you perform a git fetch, it pulls all new commits from the desired branch and stores it in a new branch in your local repository. If you want to reflect these changes in your target branch, git fetch must be followed with a git merge. Your target branch will only be updated after merging the target branch and fetched branch. Just to make it easy for you, remember the equation below:
Git pull = git fetch + git merge