What is the difference between 'git pull' and 'git fetch'?
The question above's top answer says
"In the simplest terms, git pull does a git fetch followed by git merge or git rebase."
I understand that git fetch && git rebase
is literally git pull
.
But how to use git fetch
and git merge
to achieve the same result?
Here is my experiment:
git fetch && git rebase # correctly replays remote commits in working copy
git fetch && git merge upstream/master # error
merge: upstream/master - not something we can merge
I would expect git merge
to be able to correctly replay remote commits in the current working copy - which is what git pull
does.