What will happen if I 'git fetch' or 'git pull'?
If you have used svn for years, git can seem a little strange.
Half the problem is the different mindset -- let's tackle one common
problem: How do I know what will happen if I do a
git fetch or a
pull? First let's do a status:
$ git status # On branch master # Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded.
That's a lot friendlier than svn's equivalent
svn diff. And that
status gives us the clue as to what we would like to compare: it's
simply our copy (master) and the one it's "behind" (origin/master). So
if we request:
$ git diff master origin/master
we will get a nice difference between our copy (shown in the diff with
-) and the remote (shown with
See also, these comments on stackoverflow and the Git Cheat Sheet