detached head git code example Example 1: head detached at origin/master git checkout master Example 2: git return from detached head git checkout <branchname>