symbolic ref
A ref that holds the name of another ref instead of an object ID, as HEAD normally holds the name of a branch.
In more detail
git symbolic-ref HEAD prints the branch HEAD points at, such as refs/heads/main, and fails when HEAD is detached. git rev-parse HEAD follows the chain to the commit ID instead.
Example
git symbolic-ref HEADRelated terms
- HEAD — Git's pointer to where you are: normally the name of the current branch, and through it the current commit.
- ref — A Git name that points at a commit, such as a branch (refs/heads/main) or a tag (refs/tags/v1.0).
- detached HEAD — The state where HEAD holds a commit ID directly instead of a branch name, so new commits are made but no branch moves to follow them.
Taught in
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows