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

Re: Does Git really need a commit message to go with a commit?

From
SBSanti Béjar <santi@agolina.net>
Date
Apr 4, 2010, 12:37 UTC
Message-ID
<n2madf1fd3d1004040537jd61d70c6we5ba3b294dfc10be@mail.gmail.com>
In-Reply-To
<h2m51dd1af81004040415xc7381f6cp1bf81bcfd684b99d@mail.gmail.com>

On Sun, Apr 4, 2010 at 1:15 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 20 quoted lines
> On Sat, Apr 3, 2010 at 22:26, Santi Béjar <santi@agolina.net> wrote:
>> On Sun, Apr 4, 2010 at 12:06 AM, Ævar Arnfjörð Bjarmason
>> <avarab@gmail.com> wrote:
>>> git-commit(1) doesn't allow you to make a commit without a commit
>>> message. This is annoying and doesn't properly preserve history in
>>> applications like snerp-vortex which replay a SVN dump into Git. You
>>> have to add `$msg = "Git made me do it" unless length $msg' somewhere.
>>>
>>> Is there really no way to add a commit with no message with the git
>>> tools? Will anything break if I manually construct a commit with no
>>> message? Are commit messages inherently part of the format or does
>>> git-commit(1) just think it knows better than me?
>>
>> Normally it does not make sense an empty commit message, so it is
>> forbidden by default. But there is a flag (documented in the man page)
>> since v1.5.4 (v1.5.3.7-994-g36863af git-commit --allow-empty,
>> 2007-12-03) to allow it.
>
> Actually --allow-empty allows you to commit an empty /tree/. It
> doesn't do anything for the commit message itself.

Arg! You are right, sorry for the noise. I should not write emails during the night...

I then suppose your only option is to use plumbing commands (see git(1)), in this case git-commit-tree. In general if you write scripts around git you should use only plumbing commands as they don't change the behavior.

HTH, Santi

Previous: Jeff King
Message 35 of 35 in “Does Git really need a commit message to go with a commit?”
  1. Ævar Arnfjörð BjarmasonApr 3, 2010
  2. Avery PennarunApr 4, 2010
  3. Add option to git-commit to allow empty log messagesÆvar Arnfjörð Bjarmason, Apr 4, 2010
  4. David AguilarApr 4, 2010
  5. Ævar Arnfjörð BjarmasonApr 4, 2010
  6. Junio C HamanoApr 5, 2010
  7. Sverre RabbelierApr 5, 2010
  8. Junio C HamanoApr 5, 2010
  9. Sverre RabbelierApr 5, 2010
  10. Miles BaderApr 5, 2010
  11. Junio C HamanoApr 5, 2010
  12. Jeff KingApr 5, 2010
  13. Ævar Arnfjörð BjarmasonApr 5, 2010
  14. Jonathan NiederApr 5, 2010
  15. Jonathan NiederApr 5, 2010
  16. Jeff KingApr 6, 2010
  17. Add option to git-commit to allow empty log messagesÆvar Arnfjörð Bjarmason, Apr 6, 2010
  18. Junio C HamanoApr 7, 2010
  19. Ævar Arnfjörð BjarmasonApr 7, 2010
  20. Ævar Arnfjörð BjarmasonApr 6, 2010
  21. Remove --allow-empty from the git-commit synopsisÆvar Arnfjörð Bjarmason, Apr 7, 2010
  22. Sverre RabbelierApr 7, 2010
  23. Remove --allow-empty from the git-commit synopsisÆvar Arnfjörð Bjarmason, Apr 7, 2010
  24. Sverre RabbelierApr 7, 2010
  25. Ævar Arnfjörð BjarmasonApr 7, 2010
  26. Tay Ray ChuanApr 7, 2010
  27. Remove --allow-empty from the git-commit synopsisÆvar Arnfjörð Bjarmason, Apr 7, 2010
  28. Johannes SixtApr 7, 2010
  29. Junio C HamanoApr 7, 2010
  30. Remove --allow-empty from the git-commit synopsisÆvar Arnfjörð Bjarmason, Apr 7, 2010
  31. Stephen BoydApr 7, 2010
  32. Junio C HamanoApr 7, 2010
  33. Jeff KingApr 8, 2010
  34. Jeff KingApr 6, 2010
  35. Santi BéjarApr 4, 2010

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.