I\'m very new to git and I\'m having trouble with a simple fetch operation.
I\'m trying to fetch a coworker\'s progress from his repository. At first I
Since git 1.8.4 (August 2013), git fetch will update the remote tracking branch! Not just FETCH_HEAD.
See commit f269048 from Jeff King (peff):
When we run a regular "
git fetch" without arguments, we update the tracking refs according to the configured refspec.
However, when we run "git fetch origin master" (or "git pull origin master"), we do not look at the configured refspecs at all, and just updateFETCH_HEAD.We miss an opportunity to update "
refs/remotes/origin/master" (or whatever the user has configured). Some users find this confusing, because they would want to do further comparisons against the old state of the remote master, like:
$ git pull origin master
$ git log HEAD...origin/master
But that supposes you have set your repo to fetch branches:
git config remote.origin.fetch
If empty:
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'