Git Reset to Previous Commit

Find The Commit

Log all commit history

git log

Then copy the previous hash commit you want to reset to it, commit <hash>.

Hard Reset

Once you have the hash, do hard reset

git reset --hard <hash>


git reset --hard 7e9c66afa4e45a3cc0bc6d56e67e0faea7aa3b72

Push it

Then force push to remote branch

git push -f <remote> <branch>


git push -f origin master


comments powered by Disqus