Recognize and leave detached HEAD
Checking out a commit or a tag instead of a branch puts you on a detached HEAD: you are not on any branch. You can look around and even commit, but new commits belong to no branch. Create a branch to keep them, or check out a branch to go back.
Works in GitTree Free: every local Git feature, once you are signed in.
On this page
Before you start
- You checked out a commit or a tag, for example with Check Out This Commit.
Where to find it
- The branch picker in the toolbar says Detached at … with the commit’s short SHA.
- The graph shows a HEAD, detached label on the commit you are on.
| Action | macOS | Windows and Linux |
|---|---|---|
| Jump to HEAD | ⌘⇧H | Ctrl+Shift+H |
Steps
Recognize it
Look at the branch picker: Detached at 6caad4e instead of a branch name. Actions that need a branch say Check out a branch first: HEAD is detached.
Keep what you made here
If you committed while detached, right-click HEAD’s commit and choose Create Branch Here…. Your commits now belong to that branch.
Go back to a branch
Double-click a branch label, or pick a branch in the branch picker. HEAD is attached again.
Expected result
You are on a branch again, and any work from the detached HEAD is kept on a branch of its own.
Why it happens
- Checking out a commit or a tag, to test an old version.
- Some steps of a rebase or bisect, which GitTree shows in its banner.
- A worktree created for a single commit.
If something goes wrong
“Check out a branch first: HEAD is detached.”
The action needs a branch, such as pull or rebase. Check out a branch and try again.
Questions
Is a detached HEAD an error?
No. It is a normal Git state for looking at history. It only matters if you commit there and then leave without creating a branch.