4 ms·
I think what many people miss is that if you have a remote repository called, say, "origin", and a local branch synced with it called, say, "master", then there
by losvedir 13y ago
I think what many people miss is that if you have a remote repository called, say, "origin", and a local branch synced with it called, say, "master", then there's a behind-the-scenes local branch called "origin/master". This third branch is what your local git repository knows about the remote branch.
[ master ] -------------- [origin/master | master]
remote local
With this model in mind the difference is pretty clear. `git fetch` pulls down all the new stuff from origin and updates origin/master but leaves your local master untouched. You can then merge origin/master into your local master to bring it up to date. `git pull` just does both steps: pull down the remote data into origin/whatever, and then merge origin/whatever into whatever.
master | origin/master | master
----------------->
git fetch
----------------->--------------->
git pull