Git merge after fetch - how, exactly?
I typically do this:
git merge --ff-only @{u}
Which says, "only do a fast-forward merge from the upstream tracking branch." It's nice because if it fails, then I know I introduced something on master
that is not upstream. I have that aliased to ff
, just to make it easier to type.
If there are changes, and you simply want to merge them, you can do:
git merge @{u}
Which will merge in the upstream branch. However, if you'd like a cleaner history (and avoid the "Merging 'origin/master' into 'master'" commits, then you might want to consider rebasing instead:
git rebase @{u}
Of course, you can you origin/master
instead of @{u}
in any of these examples.
git merge origin/master
should work. Since master
is usually a tracking branch, you could also do git pull
from that branch and it will do a fetch & merge for you.
If you have local changes on your master
that aren't reflected on origin
, you might want git rebase origin/master
to make sure your commits are 'on top'.