Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
Created August 3, 2013 20:13
Show Gist options
  • Save ursuleacv/6147833 to your computer and use it in GitHub Desktop.
Save ursuleacv/6147833 to your computer and use it in GitHub Desktop.
How to undo the last Git commit?
git log # to see the last commit id
git reset --hard 5a7404742c85
#or
#git reset --hard HEAD^ # use --hard if you don't care about keeping the changes you made
git commit -am 'restoring the file I removed on accident'
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment