Skip to content

Instantly share code, notes, and snippets.

@wongjiahau
Last active August 17, 2017 01:35
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 wongjiahau/ba712f8e55d9c3dd38be68fdb47b43ab to your computer and use it in GitHub Desktop.
Save wongjiahau/ba712f8e55d9c3dd38be68fdb47b43ab to your computer and use it in GitHub Desktop.
#Delete last commit at remote (e.g. GitHub)
git push -f origin HEAD^:master
#Delete a particular commit at local git
git reset --hard <sha1-commit-id>
#Deleting last commit locally (HEAD~1 means last commit)
git reset --hard HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment