Detached HEAD nastane, když HEAD ukazuje přímo na commit místo na větev. Jedná se o normální stav (není to chyba), který se stane, když si vyberete konkrétní commit, tag nebo vzdálený commit — ale commitování v tomto stavu může vést ke ztrátě práce, proto je důležité tomu rozumět.
Co HEAD normálně ukazuje
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
Kdy nastane detached HEAD
git checkout <commit-hash>
git checkout v1.0.0
git checkout origin/main
