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

Re: Fwd: Possible bug report: `git commit -ammend`

From
Jeff King <peff@peff.net>
Date
Nov 16, 2013, 04:02 UTC
Message-ID
<20131116040214.GA24804@sigill.intra.peff.net>
In-Reply-To
<CACsJy8Ckb+qdQFcTHPcAiRy_08Nxtz5Uh_9R+NXz4yixWR9DUQ@mail.gmail.com>
On Sat, Nov 16, 2013 at 10:28:36AM +0700, Duy Nguyen wrote:
Show 12 quoted lines
> > Yes. This is a rather widespread convention (e.g. rm -fr == rm -r -f).
> > Git does a special-case for -amend to avoid confusion:
> >
> >   $ git commit -amend
> >   error: did you mean `--amend` (with two dashes ?)
> >
> > But it did not special-case the double-typo.
> 
> "-m" taking a string without a space or '=' increases the risk of this
> typo. If it does require '=' or ' ' after -m then -ammend is more
> likely to be rejected. Anybody know why we should support -mabc,
> besides convenient?

For flags with optional arguments, "-m abc" would not work (we do not know if "abc" is the argument or the next flag). An example of such a flag is "git status -uall".

We could disallow it for mandatory options, but that would create an inconsistency in the option parsing.

Other than that, I think it is mostly convenience and compatibility with other option-parsing systems.

-Peff
Previous: Duy Nguyen
Message 4 of 4 in “Fwd: Possible bug report: `git commit -ammend`”
  1. rhys evansNov 15, 2013
  2. Matthieu MoyNov 15, 2013
  3. Duy NguyenNov 16, 2013
  4. Jeff KingNov 16, 2013

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.