You see the Git documentation saying things like
The branch must be fully merged in HEAD.
But what is Git HEAD exac
I'd just like to detail a few things in Greg Hewgil's accepted answer. According to the Git Pocket Guide
Branch:
the branch itself is defined as all points reachable in the commit graph from the named commit (the “tip” of the branch).
HEAD: A special type of Ref
The special ref HEAD determines what branch you are on...
Refs
Git defines two kinds of references, or named pointers, which it calls “refs”:
- A simple ref, which points directly to an object ID (usually a commit or tag)
- A symbolic ref (or symref), which points to another ref (either simple or symbolic)
As Greg mentioned, HEAD can be in a "detached state". So HEAD can be either a simple ref (for a detached HEAD) or a symref.
if HEAD is a symbolic ref for an existing branch, then you are “on” that branch. If, on the other hand, HEAD is a simple ref directly naming a commit by its SHA-1 ID, then you are not “on” any branch, but rather in “detached HEAD” mode, which happens when you check out some earlier commit to examine.