Skip to content

Instantly share code, notes, and snippets.

@joyrexus
Created December 6, 2013 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joyrexus/7830840 to your computer and use it in GitHub Desktop.
Save joyrexus/7830840 to your computer and use it in GitHub Desktop.
Undo a pushed commit

How to undo a commit that's already been pushed to a remote?

First, reset your local branch to the parent of the current commit:

git reset HEAD^ --hard

Then, push the reverted HEAD point to the remote:

git push --force origin

For more details see this post and this thread on StackExchange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment