How to Undo Your Most Recent Commit in Git

by Admin 13. April 2018 18:50

If you want to do undo your last commit in Git what you will do is type the following command on your Terminal (Mac) or Command Prompt (Windows)

git reset HEAD~

This will leave your working tree unchanged but undo the commit. After this you will see all files from your commit back in un-staged status. Now you can make your changes and add back the files and commit again.

Also, if you are only trying to undo the message from your last commit then you can type the following command:

git commit -- amend

This will open up you Vim (or your custom editor in case you have changed it). You can modify the message and save. If you will like to see a video of all this being performed please watch the video below.

Tags:

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

© 2014 FMR Web Design Delray Beach, Florida | P: (561) 235-3775 | E: info@fmrwebdesign.com