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

Commits with empty commit messages

From
GUGeert Uytterhoeven <geert.uytterhoeven@sonycom.com>
Date
Feb 25, 2009, 12:50 UTC
Message-ID
<alpine.LRH.2.00.0902251338230.21065@vixen.sonytel.be>

I accidentally managed to create a commit with an empty commit message using `git am' with a patch that didn't have a subject line. It didn't matter much, as I just wanted to squash it during a rebase anyway.

However, during `git rebase -i', I got a corrupt list of commits. Instead of the usual:

| pick sha1 desc1
| pick sha2 desc2
I saw:
| pick sha1 >sha2 desc2

If you have a commit with an empty commit message, you can also not fix this using amend:

| $ git commit --amend
| fatal: commit has empty message
| $

If you use `git rebase -i' to rebase one or more commits, _all_ of them with empty commit messages, you don't see any of the familiar `pick' lines, but just

| noop
and you `loose' all those commits as soon as you quit your editor.

Probably the real offender is `git am', which allows empty commit messages, unlike `git commit'.

While trying to create a clean test case, I also noticed you cannot use `git am' to create the first commit in a freshly initialized empty git repository. It fails with:

| $ git am patch
| fatal: HEAD: not a valid SHA1
| fatal: bad revision 'HEAD'
| $
I'm using 1.6.0.4, but I could reproduce the issues with 1.6.2.rc1.41.g3f74c.
With kind regards,

Geert Uytterhoeven Software Architect

Sony Techsoft Centre Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010

Message 1 of 1 in “Commits with empty commit messages”
  1. Geert UytterhoevenFeb 25, 2009

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.