Revert Git to a specific commit


Sometimes, you might want to revert to a specific commit because the commit tree looks ugly or some other reasons. To fix it, follow these steps:

Create a backup branch for safety reason.

$ git checkout -b backup

Reset to a specific commit

$ git reset --hard COMMIT_ID

Force push to server to override the commit tree

$ git push STREAM BRANCH -f

That should be it. However, if there is any mistake, just revert from the backup branch.