git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to make devs write better commit messages

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2011, 02:28 UTC
Message-ID
<7vaa75cdzi.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4EDEA2E2.3030002@elegosoft.com>
Michael Schubert <mschub@elegosoft.com> writes:
Show 5 quoted lines
>> What are your thoughts?
>
> If it's no social issue but just due to lack of a reminder you
> could provide a template for commit.template. Either way: you
> still would have to force people to set it.?

While that would be a good first step, I think people will learn best when they feel by their skin how good log messages help them in the long run.

Pick a recent bugfix in your project, analyze why the code was broken by the bug in the first place, and view the log message of the commit that introduced the code that was broken by the buggy commit. You will often notice that the original commit did not explain why the code needs to be that way sufficiently, risking later breakage, and the buggy commit that broke the code did not justify the change any more than "This happens to make something work for me in a particular narrow case".

And then look at the log message of the bugfix. Does it explain why the broken change was bad, and the fixed code _has to be_ that way?

Do this for a handful of examples, and you will start noticing patterns, and what makes good messages that become useful in the longer term. Have your people learn from good ones _as well as_ the bad ones.

Have fun.
Previous: Michael SchubertNext: Hilco Wijbenga
Message 3 of 5 in “How to make devs write better commit messages”
  1. Joseph HuttnerDec 6, 2011
  2. Michael SchubertDec 6, 2011
  3. Junio C HamanoDec 7, 2011
  4. Hilco WijbengaDec 7, 2011
  5. Thomas KochDec 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.