git go back to head after checkout commit code example Example: git go back to head after checkout commit git checkout branchname