how to get out of a detached head state code example Example: git return from detached head git checkout <branchname>