Header Ads

Here is How to Undo Last Commit in Git

Althought there is an option to edit your last commit on git by using the Git's amend feature, some people might opt to undo it completely so you can restructure it.
Here is the commant:

git reset --soft HEAD~1

The reset feature will return it to a specific revision part

If you don't want to save 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

No comments:

Powered by Blogger.