Skip to content

Instantly share code, notes, and snippets.

@aamishbaloch
Created January 1, 2018 15:12
Show Gist options
  • Save aamishbaloch/a0e59cdaf68500f2e9566a099cf4ef1d to your computer and use it in GitHub Desktop.
Save aamishbaloch/a0e59cdaf68500f2e9566a099cf4ef1d to your computer and use it in GitHub Desktop.
Undo Last Commit

Undo Last Commit

Sometime we might came across the situation where we have to undo the last commit.

So for the soft undo:

git reset --soft HEAD~1

If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.

git reset --hard HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment