Switch and Commit
HEAD is git's answer to "where am I?" — it marks the branch you are currently on.
When you commit, the branch HEAD is following moves forward to the new commit. Every other branch stays exactly where it was.
That is the whole trick of branching: two branches can move forward independently from the same starting point.
Exercises
- Exercise 1. Switch to "feature" and make a commit there. main should not move.
- Exercise 2. Make the two branches genuinely diverge: commit once on main, then switch to feature and commit there too.