Git commit editor error

If a Git commit failed because of a problem with the editor:

git commit
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.

It can be a pain to remember the commit message again.

But if you saved the message before quitting the editor, it should still be there:


This means that you can commit without having to rewrite the message:

git commit -m "$(cat .git/COMMIT_EDITMSG)"

Please support this site and join our Discord!