Search notes:

.git/HEAD

.git/HEAD contains (or points to) a commit. This commit can be pointed at using a (40 character long) SHA 1 number or using a sym ref that points to a file stored under .git/refs/heads. In the latter case, this file represents the currently active branch.
Git only changes the content of this file when the branches is changed, for example with
$ git checkout v1.1

Content of HEAD

Rather than containing a hash of an object, the content of HEAD might (textually) point to a branch.
ref: refs/heads/branch_name.
Because .git/HEAD points to a branch, the content of .git/HEAD is changed with git checkout …:
$ git checkout v.1.1
$ cat .git/HEAD
ref: refs/heads/v1.1

Detatched HEAD

If HEAD references a commit directly, it is called a detached HEAD. (man git-checkout)
Normally, the HEAD stores the name of a local branch and commands that operate on the history HEAD represents operate on the history leading to the thip of the branch the HEAD points at. In such a case, the HEAD is said to be attaced to this branch.
However, Git also allows to check out an arbitrary commit that isn't necessarily the tip of any particular branch. In such a state, the HEAD is called «detached».

Show content of HEAD

$ cat .git/HEAD
ref: refs/heads/master

$ git symbolic-ref HEAD
refs/heads/master

TODO

Merge with HEAD

See also

HEAD, .git/logs/HEAD
.git/ORIG_HEAD
.git directory structure

Index