Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Git Knowledge Snack
Logo
Git Knowledge Snack
  • Agenda
  • Introduction
  • Git Concepts
    • Distributed Version Control System
      • The Past
      • Git as a Distributed Version Control System
    • Directed Acyclic Graph
    • Git Objects
      • Git Blob
      • Git Tree
      • Git Commit
    • Git Objects - Example
    • Git Objects - Summary
    • Git References
      • Tags
      • Branches
      • Remotes
      • HEAD
    • Git References - Summary
    • The .git Directory - References
    • The .git Directory - Objects
  • Next
Back to top
View this page
Edit this page

HEAD¶

The HEAD is a special dynamic reference pointing to the branch you’re currently working on. It can be used when the latest checked out commit has to be referenced.

        gitGraph
    commit
    branch origin/feature-a
    commit
    commit
    commit
    branch BranchA
    checkout BranchA
    commit
    commit
    checkout main
    merge BranchA id: "HEAD"
    

Example from the last chapter showing HEAD¶

Most git commands default to HEAD if no reference or hash is passed as an argument.

For example:

git show --stat HEAD
# is the same as
git show --stat
Next
Git References - Summary
Previous
Remotes
Copyright © 2025, Björn Ricks CC-BY-SA-4.0
Made with Sphinx and @pradyunsg's Furo