How do I fix a Git detached head?

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