Git commit editor error


Has a commit ever 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.

Well, it must be a pain to rewrite the message again.

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

$ cat .git/COMMIT_EDITMSG

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

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