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

Re: git-rebase -i prunes commits with empty commit-message

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 10, 2010, 19:53 UTC
Message-ID
<7veijsrm19.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B979AEF.5010201@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Does git really claim to handle commits with empty commit messages?

Yes, I would say it is a bug in rebase-i if it refuses to deal with histories with such commits. Warning and giving the user a chance to add message _might_ be good, but allowing no way out would be inexcusable. Even adding a fake "(original commit had no message)" as the message and continuing would be better than stopping or dropping commits.

The Porcelain "git commit" by default complains if you do not give any message, because it usually is an end-user mistake to directly use "git commit" and not writing anything about the resulting commit. However,

 (1) The plumbing allows it because such a policy to forbid commits
     without comments does not belong there, e.g. this would succeed:
     $ git commit-tree HEAD^{tree} </dev/null
 (2) Even the Porcelain allows it if you ask nicely:
     $ git commit --cleanup=verbatim -m ''

These are primarily so that you can deal with histories created by other people's tools (e.g. foreign SCM, third party Porcelains, etc.). You do not have much control over histories created by them, and our commit creating commands need to be usable as an ingredient for you to write conversion tools (like filter-branch or rebase-i).

Previous: Erik Faye-Lund
Message 6 of 6 in “git-rebase -i prunes commits with empty commit-message”
  1. Erik Faye-LundMar 8, 2010
  2. Michael HaggertyMar 10, 2010
  3. Erik Faye-LundMar 10, 2010
  4. Erik Faye-LundMar 11, 2010
  5. Erik Faye-LundMar 11, 2010
  6. Junio C HamanoMar 10, 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.