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

Re: Make commit messages optional

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 11, 2022, 10:24 UTC
Message-ID
<220411.865ynfkj7r.gmgdl@evledraar.gmail.com>
In-Reply-To
<CA+JQ7M-uSatD4=HHxaqe4yVAJ5WGuWC_BprX4hnfKSrt6-1GEg@mail.gmail.com>
On Fri, Apr 08 2022, Erik Cervin Edin wrote:
Show 10 quoted lines
> At the risk of bikeshedding.
>
> The case in favor of not allowing empty commit messages by default is
> that most of the time, empty commit messages are useless.
>
> I've written my fair share of poor commit messages (-,..., wip, foo).
> Sometimes I've fixed that retroactively, sometimes not. The advantage
> I see with empty commit messages is that it's more ubiquitous to
> "write something better" or "whatever". The downside is I can't git
> log --grep '^$' to find them.
You can:
    git log --invert-grep --grep '.'
Show 10 quoted lines
> On Fri, Apr 8, 2022 at 7:47 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>> E.g. I wouldn't mind if we made pushes start failing (probably guarded
>> by appropriate isatty() checks) if the user was pushing content without
>> commit messages, unless some option were overridden, or we could start
>> sternly warning about that. Ditto for merging a branch into another one
>> (especially if we can see it's the default branch).
>
> I could see this being a potentially nice option but also pretty much
> .git/hooks/pre-push.sample but with rev-list --grep '^$'  (which
> doesn't appear to work)

The reason it doesn't work is that our --grep doesn't allow for matching across the whole message, we should fix that, it would be useful in other contexts.

But for this the --invert-grep above will do what you want. I.e. if our --grep matches any one character and we discard any that matched with --invert-grep we're left with empty commit messages.

Previous: Erik Cervin EdinNext: Junio C Hamano
Message 5 of 29 in “Make commit messages optional”
  1. jurgen_gjoncari@icloud.comApr 8, 2022
  2. Christian CouderApr 8, 2022
  3. Ævar Arnfjörð BjarmasonApr 8, 2022
  4. Erik Cervin EdinApr 8, 2022
  5. Ævar Arnfjörð BjarmasonApr 11, 2022
  6. Junio C HamanoApr 11, 2022
  7. Michal SuchánekApr 11, 2022
  8. Junio C HamanoApr 11, 2022
  9. Philip OakleyApr 8, 2022
  10. Phillip SusiApr 8, 2022
  11. brian m. carlsonApr 8, 2022
  12. rsbecker@nexbridge.comApr 8, 2022
  13. Michal SuchánekApr 9, 2022
  14. Tao KlerksApr 10, 2022
  15. rsbecker@nexbridge.comApr 10, 2022
  16. rsbecker@nexbridge.comApr 10, 2022
  17. Tao KlerksApr 10, 2022
  18. Jonathan NiederApr 13, 2022
  19. demerphqApr 11, 2022
  20. rsbecker@nexbridge.comApr 11, 2022
  21. Ævar Arnfjörð BjarmasonApr 11, 2022
  22. Tao KlerksApr 11, 2022
  23. Junio C HamanoApr 11, 2022
  24. Michal SuchánekApr 11, 2022
  25. tytsoApr 11, 2022
  26. Ævar Arnfjörð BjarmasonApr 11, 2022
  27. Theodore Ts'oApr 14, 2022
  28. Ævar Arnfjörð BjarmasonApr 14, 2022
  29. Junio C HamanoApr 14, 2022

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.