Skip to content

Instantly share code, notes, and snippets.

@mdaftab88
Forked from HashNuke/gist:608259
Created December 27, 2019 05:20
Show Gist options
  • Save mdaftab88/a55124d3bf85e812f165723d93180e99 to your computer and use it in GitHub Desktop.
Save mdaftab88/a55124d3bf85e812f165723d93180e99 to your computer and use it in GitHub Desktop.
to undo push and commits
# 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