Git: Temporarily revert to previous commit

Posted . Visible to the public.

If you want to go back to a previous commit, while keeping all of your other history, simply checkout that commit.

git checkout <sha-1 of that commit>

This will put you in a detached state, where you're not checked out in any branch. To go back, simply checkout a brach. You can use the shortcut git checkout - (that's a dash) to go back to your previous checkout :)

Philipp Antar
Posted by Philipp Antar to Distribusion IT (2014-02-07 11:00)