revert a git commit to a remote repository

Hey folks,

have you ever been too fast at committing and pushing to a remote git repo? maybe … you think. Git allows you to revert your pushed commit very easily. BUT don’t forget to save your changes, if you want to recall the good work there. I found a very good explanation how to do it [1].

In short you can delete your last commit by executing following commands:

git reset HEAD^ --hard
git push -f

Be fast and don’t forget to backup 😉

[1] http://christoph.ruegg.name/blog/git-howto-revert-a-commit-already-pushed-to-a-remote-reposit.html

Leave a Reply

Your email address will not be published. Required fields are marked *