Git create branch where detached HEAD is
You’re sitting on a detached HEAD: git checkout <sha> You want to make a branch at that commit: git branch my-new-branch And now switch to that branch: git checkout my-new-branch
You’re sitting on a detached HEAD: git checkout <sha> You want to make a branch at that commit: git branch my-new-branch And now switch to that branch: git checkout my-new-branch
Detached head means you are no longer on a branch, you have checked out a single commit in the history (in this case the commit previous to HEAD, i.e. HEAD^). If you want to delete your changes associated with the detached HEAD You only need to checkout the branch you were on, e.g. git checkout … Read more