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

Re: git-commit --amend -m "..." complains?!?

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 1, 2007, 19:52 UTC
Message-ID
<7vk5sf3uct.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<85myxbrrdl.fsf@lola.goethe.zz>
David Kastrup <dak@gnu.org> writes:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> ...
>> You can do:
>>
>> 	$ git reset HEAD^
>>         $ git commit -m "blah"
>>
>> if you do not want to reuse the commit message.
>
> You can pretty much _always_ avoid --amend in a similar manner, but
> why would you?  It is convenient.

No need to be upset about what I said. I really do not want to change the minor detail this late in the 1.5.3 release cycle, and wanted to unblock you by giving an workaround in case you were stuck.

It should be a straightforward change to git-commit.sh. Instead of "Oops, -m and --amend are incompatible so we will whine" around line 300, you can treat --amend somewhat specially by (1) making it first not set log_given, which would still keep the combination of -m/-c/-C/-F incompatible, (2) when $log_given is false and we are amending, honor $use_commit to prime the message. Then you can keep the current bahaviour for amending starting from the existing message, while allowing -m/-c/-C/-F to supply different message for the replacing commit.

Previous: David KastrupNext: David Kastrup
Message 4 of 7 in “git-commit --amend -m "..." complains?!?”
  1. David KastrupAug 1, 2007
  2. Junio C HamanoAug 1, 2007
  3. David KastrupAug 1, 2007
  4. Junio C HamanoAug 1, 2007
  5. David KastrupAug 1, 2007
  6. git-commit.sh: Permit the --amend message to be given with -m/-c/-C/-F.David Kastrup, Aug 1, 2007
  7. Junio C HamanoAug 2, 2007

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.