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

[BUG] git commit --allow-empty-message -m '' fails

From
JHJosh Hagins <hagins.josh@gmail.com>
Date
May 1, 2015, 23:31 UTC
Message-ID
<CANuW5x0eKVAToG76rJr6+n-Fdg7E5c8mHb8NvnQUT2PBzxjjPQ@mail.gmail.com>

When passed the `--allow-empty-message` flag with no `-m`, `git commit` will open the editor and allow you to exit with an empty message, as expected.

However, when passed `-m ''` in addition to `--allow-empty-message`, the commit fails. Example below:

    $ git commit -a --allow-empty-message -m ''
    error: switch `m' requires a value
    usage: git commit [<options>] [--] <pathspec>...
    ...

Shouldn't the `-m` switch know whether the `--allow-empty-message` flag has been passed?

Thanks, Josh

Next: Jeff King
Message 1 of 4 in “[BUG] git commit --allow-empty-message -m '' fails”
  1. Josh HaginsMay 1, 2015
  2. Jeff KingMay 2, 2015
  3. Jeff KingMay 2, 2015
  4. Josh HaginsMay 2, 2015

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.