git return from detached head

Shell
git checkout <branchname>
Source

Also in Shell: