Detached HEAD
What it means.
When you visit an old commit, Git says your head is detached. It sounds scary, but it's simple once you know what head is.

- 'HEAD detached at 0ba6049'
- Sounds scary
- It's simple
What HEAD is
Head is just Git's way of saying, you are here. Normally, head points to a branch, like main. As you commit, main moves forward, and head moves with it. When you visit an old commit directly, head points to that commit, not a branch. That's detached. You're looking at history, not standing on a branch.
Seeing HEAD
Git status tells you where head is. While detached, it says head detached at zero b a six zero four nine. Switch back to main, and status says on branch main again. Everything is normal.
git status HEAD detached at 0ba6049 nothing to commit, working tree clean git switch main Previous HEAD position was 0ba6049 Add welcome text Switched to branch 'main' git status On branch main nothing to commit, working tree clean
Summary
Head means you are here. Detached just means you're on an old commit instead of a branch. Git switch main fixes it. Next, undoing a whole commit, safely.
Key takeaways- HEAD = you are here
- Detached = on a commit, not a branch
- git switch main