Posted in GIT

Git revert back to older commit

You have multiple commits in a branch but all gone wrong somehow and now you want to revert back to a specific commit. This is how you do:

Situation 1: Reverting to older commit

Danger Alert: All your uncommitted changes will be lost doing this. If you have such, prefer next situation.

git reset --hard <commit_code>
git commit -m "Reverted to <commit_code>"

Replace <commit_code> with your commit SHA Eg. 9acbb770

Continue reading “Git revert back to older commit”

Advertisements