HEAD
Medium — good to knowGit & Version Control
ELI5 — The Vibe Check
HEAD is like a bookmark that says 'you are here' in your Git history. It points to the commit you're currently looking at. When you switch branches, HEAD moves to point at the latest commit on that branch.
Real Talk
HEAD is a reference to the current commit in your working directory. It typically points to the tip of the current branch. A 'detached HEAD' state occurs when HEAD points directly to a commit rather than a branch.
Show Me The Code
git log --oneline HEAD # see where HEAD is
git reset HEAD~1 # move HEAD back one commit
git diff HEAD # changes since current commit
When You'll Hear This
"Reset to HEAD." / "You're in detached HEAD state — checkout a branch."
Related Terms
Branch
A branch is like creating a parallel universe for your code.
beginnerGit & Version Control
Checkout
Checkout is like teleporting to a different branch or going back in time to an old version.
beginnerGit & Version Control
Commit
A commit is like pressing the save button in a video game.
beginnerGit & Version Control
Reset
Reset is like pressing undo on your commits.
advancedGit & Version Control