Category Archives: Git

Git: Force reverting to a previous commit

Reverting to a previous commit in git. These commands seem to always get lost on the interwebs.

# Reset the index and working tree to the hash
git reset --hard 23h8f32378

# Move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}

git commit -m "Revert to 23h8f32378"