Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View older failed commit messages

Tags:

git

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?

like image 995
Sunil Venkatraman Avatar asked Sep 30 '22 21:09

Sunil Venkatraman


1 Answers

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.

like image 142
VonC Avatar answered Oct 04 '22 15:10

VonC