Skip to content

Instantly share code, notes, and snippets.

@xmalinov
Forked from HashNuke/gist:608259
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xmalinov/9c1279e0217dd6ce0f07 to your computer and use it in GitHub Desktop.
Save xmalinov/9c1279e0217dd6ce0f07 to your computer and use it in GitHub Desktop.
Undo a git push
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment