fetch vs pull
fetch will download any changes from the remote* branch, updating your repository data, but leaving your local* branch unchanged.
pull will perform a fetch and additionally merge the changes into your local branch.
What’s the difference? pull updates you local branch with changes from the pulled branch. A fetch does not advance your local branch.
merge vs rebase
Given the following history:
C---D---E local
/
A---B---F---G remote
merge joins two development histories together. It does this by replaying the changes that occurred on your local branch after it diverged on top of the remote branch, and record the result in a new commit. This operation preserves the ancestry of each commit.
The effect of a merge will be:
C---D---E local
/ \
A---B---F---G---H remote
rebase will take commits that exist in your local branch and re-apply them on top of the remote branch. This operation re-writes the ancestors of your local commits.
The effect of a rebase will be:
C'--D'--E' local
/
A---B---F---G remote
What’s the difference? A merge does not change the ancestry of commits. A rebase
rewrites the ancestry of your local commits.
* This explanation assumes that the current branch is a local branch, and that the branch specified as the argument to fetch, pull, merge, or rebase is a remote branch. This is the usual case. pull, for example, will download any changes from the specified branch, update your repository and merge the changes into the current branch.