git pull --help says:
In its default mode,
git pullis shorthand forgit fetchfollowed bygit merge FETCH_HEAD.
What is this FETCH_HEAD and what is actually merged during git pull?
2022-02-19
git pull --help says:
In its default mode,
git pullis shorthand forgit fetchfollowed bygit merge FETCH_HEAD.
What is this FETCH_HEAD and what is actually merged during git pull?
FETCH_HEAD is a short-lived ref, to keep track of what has just been fetched from the remote repository. git pull first invokes git fetch, in normal cases fetching a branch from the remote; FETCH_HEAD points to the tip of this branch (it stores the SHA1 of the commit, just as branches do). git pull then invokes git merge, merging FETCH_HEAD into the current branch.
The result is exactly what you'd expect: the commit at the tip of the appropriate remote branch is merged into the commit at the tip of your current branch.
This is a bit like doing git fetch without arguments (or git remote update), updating all your remote branches, then running git merge origin/<branch>, but using FETCH_HEAD internally instead to refer to whatever single ref was fetched, instead of needing to name things.