Why isn't FETCH_HEAD
checked out right after fetching? Why did it only become checked out after I merged the origin's tracking branch into my local master?
FETCH_HEAD
in itself doesn't reference any branch: it only remember the last fetched SHA1.
As it doesn't reference a branch, it isn't really checked out (and shouldn't be checked out), or you would end up with a detached head.
However, merging the tracking branch to the master
branch will update HEAD
(which points to the updated master): that branch is checked out.
If the merge is a "fast-forward" one, the checked-out branch HEAD
and FETCH-HEAD
would reference the same SHA1, giving the impression that FETCH_HEAD
is "checked out" (it isn't really)
In other words, in the following picture:

FETCH_HEAD
has the "checked-out" tick only because it reference the same SHA1 than the current checked-out branch HEAD
(here master
).
That means that, if you do a new commit:
FETCH_HEAD
wouldn't have the checked-out tick anymore (it would still reference the last fetched SHA1). That is why I say it isn't "really" checked-out (in the sense of "it wouldn't stay checked-out after a new commit, since it is a fixed reference to a particular SHA1)
HEAD
and the master
branch would reference a new SHA1, and would keep the checked-out tick.
But if you were to check out directly the FETCH_HEAD
SHA1 (before merging it to master
: the Egit User Guide mentions you can do that if the reference isn't already checked-out), then:
FETCH_HEAD
would still be "checked-out"
- same for
HEAD
- but
master
(or any other branch) would not be checked-out anymore: this is a DETACHED HEAD situation
If you were to make a new commit on top of a checked-out FETCH_HEAD
:
FETCH_HEAD
would no longer be checked-out (since it remains fixed on the last fetched SHA1)
- HEAD would point to the new commit checked-out.
- no branch would be "checked-out": detached HEAD.
You would need to open that checked-out commit done on top of FETCH_HEAD
, and create a branch from there:

(from the article "Git Lesson: Be mindful of a detached head")
In conclusion:
Each time you see a "checked-out tick" on the FETCH_HEAD
reference, it is because it references the same SHA1 than the ref currently checked out (either a commit, or a branch).
It is not because FETCH_HEAD
itself is checked out: it you do a new commit on top of it, it won't be checked out anymore.