Version Control

HEAD

What is HEAD ?

HEAD is a ref (reference) to the currently checked out commit.

In normal states, it’s actually a symbolic ref to the branch you have checked out — if you look at the contents of .git/HEAD you’ll see something like “ref: refs/heads/master”. The branch itself is a reference to the commit at the tip of the branch. Therefore, in the normal state, HEAD effectively refers to the commit at the tip of the current branch.

Generally speaking, HEAD is just a convenient name to mean “what you have checked out” and you don’t really have to worry much about it. Just be aware of what you have checked out, and remember that you probably don’t want to commit if you’re not on a branch (detached HEAD state) unless you know what you’re doing (e.g. are in an interactive rebase).

Like what you read? Give thakgod richard a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.