I PGP sign my commit messages, and every once in a while GPG will fail for whatever reason (invalid cache, incorrect pin, etc), and my fugitive buffer will close, loosing all my changes.
It doesn't happen often, but when it does it's really frustrating because I like to write thorough commit messages.
My question is, does anyone have a suggestion of how to retrieve the message I wrote after the commit fails?
Thanks in advance.
.git/COMMIT_MESSAGEbut it wasn't present. Maybe git thinks if GPG encryption fails it should wipe the message?
BufPreWriteor similar command to make a backup of the message?
.git/COMMIT_EDITMSG! I'll be able to write a command similar to what you provided in second part of your answer to leverage it inside vim. If you want to update your answer below to just include
.git/COMMIT_EDITMSGi'll upvote and mark as answer.