Git Commit Messages
Discussions center on the importance, best practices, and debates around writing effective Git commit messages, emphasizing whether they should explain 'why' changes were made versus just 'what' changed, with examples of good and bad messages.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Because commit messages are important.
Counter-anecdata: I read git history extremely frequently, across a variety of projects. Useless commit messages suck.
The "why" should be in the commit message. That's what it's for
Commit messages are the developer docs for a change yes
Write better commit messages. Garbage in, garbage out.
Good commit logs or comments may tell you why
Motivation for us all to write good commit messages.
Related: Greg Ward - Documenting history, or How to write great commit messages: say what, not why. https://www.youtube.com/watch?v=Jb6ij4eRu6c#t=378
This is just polishing bad commit messages, it doesn't make them better.A commit message should tell you why the code changed, not summarize what changed. I can read a code change and see what it does, but I can only guess what caused that change to be made unless the message tells me what was in your head (unless it's a trivial commit like a typo fix)See eg https://cbea.m
Because it doesn't put you in the right mindset.A commit message should be formatted like an email to your past self, or your future collaborators. It should have a very descriptive and concise title (the first line of the message) written in the present tense and after a line break you should (when necessary) write an email style explanation of the reasoning behind the commit.If you fixed something, is there context that should be useful for someone discovering this commit in a vacuu