While Git does not have a "pointer object" type,
tag
objects and ref
s serve as pointers that reference existing objects. In other words, they are simply names that point to a commit object's SHA-1 hash.HEAD
: Points to currently checked out commit (usually points to branch)
- Branch names (e.g.
main
,dev
): Mutable refs pointing to specific commits
tag
: Immutable ref pointing to specific commit
ORIG_HEAD
: Points to HEAD position beforerebase
,merge
,reset
FETCH_HEAD
: Points to latest commit from fetch
MERGE_HEAD
: Points to merge target commit during merge conflicts
CHERRY_PICK_HEAD
: Points to cherry-pick commit during conflicts
REBASE_HEAD
: Points to state during rebase conflicts
git show HEAD git show main
ls .git/refs/heads ls .git/refs/tags
git pointers