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

Re: [PATCH] Documentation: --amend cannot be combined with -c/-C/-F.

From
MWMark Wooding <mdw@distorted.org.uk>
Date
Jan 25, 2007, 12:29 UTC
Message-ID
<slrnerh8la.7v0.mdw@metalzone.distorted.org.uk>
In-Reply-To
<20070124195446.GA13817@bohr.gbar.dtu.dk>
Peter Eriksen <s022018@student.dtu.dk> wrote:
> We used to get the following confusing error message:
>
> % git commit --amend -a -m foo
> Option -m cannot be combined with -c/-C/-F
Hmm.  The log-message options to git commit seem confused to me.

The default behaviour is to fire up an editor for the user to provide a message. The editor buffer may be pre-initialized, e.g., because MERGE_MSG exists.

This default behaviour can be overridden in a number of ways:
  * -m forces the message to be its argument;
  * -F forces the message to be the contents of some file;
  * -C forces the message to be a copy of some other commit message.

So far, so good. One can see why all of these options are mutually exclusive. The problem is in the mess of other options like -c and --amend.

Currently -c (copy some other commit message, and then edit it) is considered to be a `force message to be...' kind of option, like the others I've listed above.

So, for some reason, is --amend. This last is really annoying. I frequently find that I end up typing

  VISUAL=: git commit --amend ...

to fix the stupid thing I forgot to do before I committed last time. No, dammit, I don't want to mess with the editor.

Somewhere in all of this is a fairly nice, regular set of operations trying to escape. There are two processes at work:

  * setting a default message, and
  * maybe getting the user to edit it.

The first part is slightly complicated: there are a number of places to get a default message from, and several might be possible:

  * explicitly specified by the user (e.g., -m);
  * found lying about in MERGE_MSG;
  * picked up from the HEAD commit (for --amend); or
  * empty.

Choosing between MERGE_MSG and --amend is difficult; indeed, they probably ought to be mutually exclusive. But both should obviously win over an empty initial message, and (I think) just as obviously lose to an explicit message -- after all, the purpose of --amend is primarily to replace the current HEAD commit, not to fill in a default message.

-- [mdw]
Previous: Peter EriksenNext: Junio C Hamano
Message 2 of 4 in “Documentation: --amend cannot be combined with -c/-C/-F.”
  1. Documentation: --amend cannot be combined with -c/-C/-F.Peter Eriksen, Jan 24, 2007
  2. Mark WoodingJan 25, 2007
  3. Junio C HamanoJan 25, 2007
  4. Matthias LederhoferJan 25, 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.