Git Internals HEAD ref


HEAD is a special ref. It always points to the current object.

You can see where it's currently pointing by checking the .git/HEAD file.

Normally, HEAD points to another ref:

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

But it can also point directly to an object:

$ cat .git/HEAD

This is what's known as a "detached head" - because HEAD is not attached to (pointing at) any ref, but rather points directly to an object.