HEAD ref
suggest changeHEAD 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
4bb6f98a223abc9345a0cef9200562333
This is what’s known as a “detached HEAD” - because HEAD is not attached to (pointing at) any ref, but rather points directly at a commit. Commands that update the current branch do not move any branch while HEAD is detached.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents