When you need to undo your last git commit…

$ git commit ...              (1)
$ git reset --soft HEAD~1 (2)
<< make corrections >> (3)
$ git add .... (4)
$ git commit -c ORIG_HEAD (5)
  1. The last commit what should be undone.
  2. Reset to the parent “commit”, “soft” option does not touch the index file or the working tree at all, but resets the head to ,.
  3. Make corrections to working tree files.
  4. Stage changes for commit.
  5. Commit the changes.