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

4 messages from 2013-11-15 to 2013-11-16. Participants: rhys evans, Matthieu Moy, Duy Nguyen, Jeff King.
Thread: https://gitlist.dev/t/35345

## rhys evans, 2013-11-15 15:44

Subject: Fwd: Possible bug report: `git commit -ammend`
Message-ID: <CAMyx444wJeQUpxZmXmYx-mKE0kniO=ELo5HgzQ1unV4O15oxWw@mail.gmail.com>
URL: https://gitlist.dev/e/CAMyx444wJeQUpxZmXmYx-mKE0kniO%3DELo5HgzQ1unV4O15oxWw%40mail.gmail.com
In-Reply-To: <CAMyx446B1U30RL9X7vOrY-u7fQ_cEqRJxn_M8Wn8PuOJhdO-1Q@mail.gmail.com>

```
I ran `git commit -ammend` on a repo where 1 out of 3 files changed
were staged for commit.

I would've expected an error to be thrown due to the double typo but
instead it committed all 3 files with the message 'mend'.

So it looks like it interpreted it as `git commit -a -m 'mend'`.

I'm running git 1.8.3.4 using iTerm 1.0.0 on OSX 10.9.

-- 

------------------------------
This email was sent by a company owned by Pearson plc, registered office at 
80 Strand, London WC2R 0RL.  Registered in England and Wales with company 
number 53723.

```

## Matthieu Moy, 2013-11-15 15:54

Subject: Re: Fwd: Possible bug report: `git commit -ammend`
Message-ID: <vpqsiux1wz3.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqsiux1wz3.fsf%40anie.imag.fr
In-Reply-To: <CAMyx444wJeQUpxZmXmYx-mKE0kniO=ELo5HgzQ1unV4O15oxWw@mail.gmail.com>

```
rhys evans <rhys.evans@ft.com> writes:

> I ran `git commit -ammend` on a repo where 1 out of 3 files changed
> were staged for commit.
>
> I would've expected an error to be thrown due to the double typo but
> instead it committed all 3 files with the message 'mend'.
>
> So it looks like it interpreted it as `git commit -a -m 'mend'`.

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.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Duy Nguyen, 2013-11-16 03:28

Subject: Re: Fwd: Possible bug report: `git commit -ammend`
Message-ID: <CACsJy8Ckb+qdQFcTHPcAiRy_08Nxtz5Uh_9R+NXz4yixWR9DUQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8Ckb%2BqdQFcTHPcAiRy_08Nxtz5Uh_9R%2BNXz4yixWR9DUQ%40mail.gmail.com
In-Reply-To: <vpqsiux1wz3.fsf@anie.imag.fr>

```
On Fri, Nov 15, 2013 at 10:54 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> rhys evans <rhys.evans@ft.com> writes:
>
>> I ran `git commit -ammend` on a repo where 1 out of 3 files changed
>> were staged for commit.
>>
>> I would've expected an error to be thrown due to the double typo but
>> instead it committed all 3 files with the message 'mend'.
>>
>> So it looks like it interpreted it as `git commit -a -m 'mend'`.
>
> 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?
-- 
Duy

```

## Jeff King, 2013-11-16 04:02

Subject: Re: Fwd: Possible bug report: `git commit -ammend`
Message-ID: <20131116040214.GA24804@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20131116040214.GA24804%40sigill.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:

> > 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

```
