Just checkout to the branch you want:

$ git checkout <branch>

For instance:

$ git checkout master


If you want to keep the chances you are working you should create new branch or stash your changes.


Any checkout of a commit that is not the name of one of your branches will get you a detached HEAD. A SHA1 which represents the tip of a branch still gives a detached HEAD. Only a checkout of a local branch name avoids that mode.

When HEAD is detached, commits work like normal, except no named branch gets updated. It is like an anonymous branch.

Detahced HEAD

For example, if you checkout a remote branch without tracking it first, you can end up with a detached HEAD.

For more info: Visual Git Reference

All done!