dev@local: ~/project — git
dev@local~/project$git checkout a1b2c3d
Note: switching to 'a1b2c3d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches.
Diagnostics Translation
You checked out a specific commit, detaching your working directory from the branch history.
waiting for resolution...
LowVersion Control System

Reviewed for reference consistency: April 11, 2026

State Confusion

WARNING

Your repository history is in a split or detached state. New commits might be orphaned if not managed carefully.

What To Know

This state means HEAD points directly at a commit instead of a branch name, so new commits can become hard to find unless they are attached to a branch later.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
The error involves the internal Git database or commit history structure.

Commands That Trigger This

$git checkout a1b2c3d
Running to view an older version of the project
$git checkout v1.0.0
Checking out a tag with without creating a branch

Technical Background

01

A detached HEAD is not an error—it is a valid read-only state for exploring history.

02

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

Checking out a specific commit hash
Checking out a remote-tracking branch directly
Checking out a tag instead of a local branch

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