I have performed git commit
followed by a git push
. How can I revert that change on both local and remote repositories?
$ git log
commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8
Author: Michael Silver <Michael [email protected]>
Date: Tue Jun 11 12:24:23 2011 -0700
git reset --hard HEAD~1
git push -f <remote> <branch>
(Example push: git push -f origin bugfix/bug123
)
This will undo the last commit and push the updated history to the remote. You need to pass the -f
because you're replacing upstream history in the remote.