← back to diagnosis

detached HEAD

safe

You checked out a specific commit and now HEAD is detached. Don't panic — your branches are fine.

$ git checkout main

Replace "main" with whatever branch you want. This reattaches HEAD and you're back to normal.

If you committed while detached and want to keep those commits:

$ git branch my-new-branch
$ git checkout my-new-branch

This creates a new branch pointing at your current commit, preserving your work. Then you can merge it wherever you need.