What does HEAD point to in Git, and what is a symbolic ref?
Last updated
HEAD marks your current position. Normally
.git/HEADholdsref: refs/heads/main, so commits advance that branch.A symbolic ref points to another ref by name rather than a SHA (managed with
git symbolic-ref).In detached HEAD, HEAD holds a raw commit SHA, so new commits belong to no branch.
- https://git-scm.com/book/ms/v2/Git-Internals-Git-References
- https://git-scm.com/docs/git-symbolic-ref
- https://www.kernel.org/pub/software/scm/git/docs/git-symbolic-ref.html
- https://blog.devgenius.io/what-are-git-refs-the-invisible-threads-of-version-control-3200d8f594c8
- https://www.atlassian.com/git/tutorials/refs-and-the-reflog