5

If a git commit fails, the commit message can be recovered from the .git/COMMIT_EDITMSG file. This file gets overwritten by the last commit message that is attempted. Is there a way to view a failed commit message that was used before the last one?

emallove
  • 1,417
  • 1
  • 17
  • 22

1 Answers1

4

Not natively with Git. You would have to setup an external process which:

  • would detect any changes in that file
  • save it with a differ name

But you would review those past commit messages on your own.

This answer mentions the possibility to reuse past commit message with:

git commit --reuse-message=head@{1}

That isn't exactly what you want (in term of message of "past failed commits", but is the only native git way I know of using past commit messages.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yeah, I had thought of this...Its just a little too tedious because would i not end up saving every commit message that was attempted, not just the ones that failed? – Sunil Venkatraman May 05 '14 at 16:25