go back to previous git branch code example Example 1: git go to previous branch git checkout - Example 2: git go back to previous commit git checkout 12feg3435 #commit ID