Reviewed for reference consistency: April 11, 2026
State Confusion
WARNINGYour repository history is in a split or detached state. New commits might be orphaned if not managed carefully.
What To Know
Where Did It Fail?
Commands That Trigger This
Technical Background
A detached HEAD is not an error—it is a valid read-only state for exploring history.
However, it is dangerous for writing code. Any new commits made in a detached HEAD state do not belong to any branch. If you switch away, those commits will become 'orphaned' and eventually deleted by Git's garbage collector unless you create a branch to save them.
Underlying Causes
Frequently Asked Questions
Not immediately. You can save them by creating a new branch right now using `git branch <new-branch-name>` before switching away.
Related Git States
Git cannot resolve 'HEAD' because the repository has no commits yet.
Git could not parse your input as a valid commit, branch, or file path.
Your local branch contains commits that have not yet been pushed to the remote server.