Irrotettu HEAD ilmenee, kun HEAD osoittaa suoraan commitiin eikä haaraan. Se on normaali tila (ei virhe), joka tapahtuu, kun tarkistat tietyn commitin, tagien tai etäkcommitin — mutta commitointi siinä vaarantaa työn häviämisen, joten sen ymmärtäminen on tärkeää.
Mihin HEAD normaalisti osoittaa
NORMALLY: HEAD → a BRANCH (e.g. main) → a commit
→ when you commit, the branch pointer advances, and HEAD follows it
DETACHED: HEAD → directly to a COMMIT (not through a branch)
→ you're "not on any branch" — looking at a specific commit
Milloin irrotettu HEAD tapahtuu
git checkout <commit-hash>
git checkout v1.0.0
git checkout origin/main
