What the Git HEAD is
In my crash course introduction to Git and all its terminologies and commands, no term was as confusing as the word ‘HEAD’. Different people had apparently differing opinions of what the term meant which didn’t help with my conundrum.
One day and a gazillion webpages later, I have a more holistic understanding of what the HEAD means. I’ll state that the differing opinions mentioned were correct but not complete.
So lets get to it. What is the HEAD?
- In most cases, the HEAD refers to or points to the latest commit in the current branch that you are working on. For example, if you are on the master branch, the HEAD is the latest commit in the master branch, if you switch to a feature-branch, the HEAD switches to the latest commit in the feature-branch.
- In other rarer cases, the HEAD refers to or points to a particular commit or tag and is called a detached HEAD.
I hope this was informative.