git commit -m "Something terribly misguided" git reset HEAD~1 # edit files as necessary git add ... git commit -c ORIG_HEAD
git commit -m "Something terribly misguided"
git statusand you’ll need to add them again before committing). If you only want to add more changes to the previous commit, or change the commit message1, you could use
git reset --soft HEAD~1instead, which is like
git reset HEAD~1but leaves your existing changes staged.
git reset HEAD~1
git addanything that you want to include in your new commit.
git add ...
resetcopied the old head to
-c ORIG_HEADwill open an editor, which initially contains the log message from the old commit and allows you to edit it. If you do not need to edit the message, you could use the
git commit -c ORIG_HEAD