HEAD

Git's pointer to where you are: normally the name of the current branch, and through it the current commit.

In more detail

The file .git/HEAD usually contains a line such as ref: refs/heads/main. Committing follows HEAD to find which branch to move; switching branches rewrites HEAD. Most commands assume HEAD when you name no commit, and HEAD~1 means the commit before it.

Examples

cat .git/HEAD
git rev-parse HEAD

Related terms

Taught in

References

Certification courses