# Re: git commit --amen

7 messages from 2012-10-04 to 2012-10-04. Participants: Phil Hord, Romain Vimont (®om), Erik Faye-Lund, Junio C Hamano.
Thread: https://gitlist.dev/t/31725

## Romain Vimont (®om), 2012-10-04 14:10

Subject: git commit --amen
Message-ID: <0d559e3191a392841124d96870a67735@rom1v.com>
URL: https://gitlist.dev/e/0d559e3191a392841124d96870a67735%40rom1v.com

```
Hi,

Is it normal that "git commit --amen" actually works ?
(it does like --amend)

version 1.7.10.4

®om

```

## Phil Hord, 2012-10-04 14:25

Subject: Re: git commit --amen
Message-ID: <CABURp0rbNZSOC_Jtxfjp+j3SQR=+r0pU6vOXvc0Jnth0UU9mDA@mail.gmail.com>
URL: https://gitlist.dev/e/CABURp0rbNZSOC_Jtxfjp%2Bj3SQR%3D%2Br0pU6vOXvc0Jnth0UU9mDA%40mail.gmail.com
In-Reply-To: <0d559e3191a392841124d96870a67735@rom1v.com>

```
> Is it normal that "git commit --amen" actually works ?
> (it does like --amend)
>
> version 1.7.10.4

Yes.  From Documentation/technical/api-parse-options.txt:

    * Long options may be 'abbreviated', as long as the abbreviation
      is unambiguous.

Apparently since 2008-06-22.

So 'git commit --am' also works.  But it should probably be avoided
because of its similarity to 'git commit -am'.

Phil

```

## Romain Vimont (®om), 2012-10-04 14:38

Subject: Re: git commit --amen
Message-ID: <ace0aa63d5e822c6cdd5d9a3d20bd675@rom1v.com>
URL: https://gitlist.dev/e/ace0aa63d5e822c6cdd5d9a3d20bd675%40rom1v.com
In-Reply-To: <CABURp0rbNZSOC_Jtxfjp+j3SQR=+r0pU6vOXvc0Jnth0UU9mDA@mail.gmail.com>

```
Great !
Thank you for your answer ;-)

It does not seem to work with git diff:
git diff --cache     #missing d
git diff --cumulativ #missing e

®om

Le 2012-10-04 16:25, Phil Hord a écrit :
>> Is it normal that "git commit --amen" actually works ?
>> (it does like --amend)
>>
>> version 1.7.10.4
>
> Yes.  From Documentation/technical/api-parse-options.txt:
>
>     * Long options may be 'abbreviated', as long as the abbreviation
>       is unambiguous.
>
> Apparently since 2008-06-22.
>
> So 'git commit --am' also works.  But it should probably be avoided
> because of its similarity to 'git commit -am'.
>
> Phil

```

## Erik Faye-Lund, 2012-10-04 14:57

Subject: Re: git commit --amen
Message-ID: <CABPQNSYZkAax1iav_qS=0j8=XNDHPsWH_V4BMkpQi63iLb1rtQ@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSYZkAax1iav_qS%3D0j8%3DXNDHPsWH_V4BMkpQi63iLb1rtQ%40mail.gmail.com
In-Reply-To: <ace0aa63d5e822c6cdd5d9a3d20bd675@rom1v.com>

```
On Thu, Oct 4, 2012 at 4:38 PM, Romain Vimont (®om) <rom@rom1v.com> wrote:
> Great !
> Thank you for your answer ;-)
>
> It does not seem to work with git diff:
> git diff --cache     #missing d
> git diff --cumulativ #missing e

This is because git-diff doesn't yet use the parse-options API, but
instead does ad-hoc parsing.

```

## Junio C Hamano, 2012-10-04 16:52

Subject: Re: git commit --amen
Message-ID: <7va9w218ou.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7va9w218ou.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CABURp0rbNZSOC_Jtxfjp+j3SQR=+r0pU6vOXvc0Jnth0UU9mDA@mail.gmail.com>

```
Phil Hord <phil.hord@gmail.com> writes:

>> Is it normal that "git commit --amen" actually works ?
>> (it does like --amend)
>>
>> version 1.7.10.4
>
> Yes.  From Documentation/technical/api-parse-options.txt:
>
>     * Long options may be 'abbreviated', as long as the abbreviation
>       is unambiguous.
>
> Apparently since 2008-06-22.

Notice "technical/api-" part; that is a _wrong_ documentation page
to quote to end users.

Instead quote from "git help cli".

       From the git 1.5.4 series and further, many git commands (not
       all of them at the time of the writing though) come with an
       enhanced option parser.

> So 'git commit --am' also works.  But it should probably be avoided
> because of its similarity to 'git commit -am'.

Yes, in general, you should avoid relying on shortened form
working.  Git 2.4 may add an option "--amen" that has totally
different meaning.

```

## Junio C Hamano, 2012-10-04 16:52

Subject: Re: git commit --amen
Message-ID: <7v626q18o4.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v626q18o4.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CABPQNSYZkAax1iav_qS=0j8=XNDHPsWH_V4BMkpQi63iLb1rtQ@mail.gmail.com>

```
Erik Faye-Lund <kusmabite@gmail.com> writes:

> On Thu, Oct 4, 2012 at 4:38 PM, Romain Vimont (®om) <rom@rom1v.com> wrote:
>> Great !
>> Thank you for your answer ;-)
>>
>> It does not seem to work with git diff:
>> git diff --cache     #missing d
>> git diff --cumulativ #missing e
>
> This is because git-diff doesn't yet use the parse-options API,...

That is more like "it predates parse-options".

```

## Junio C Hamano, 2012-10-04 17:13

Subject: Re: git commit --amen
Message-ID: <7v1uhe17oy.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v1uhe17oy.fsf%40alter.siamese.dyndns.org
In-Reply-To: <7va9w218ou.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> Phil Hord <phil.hord@gmail.com> writes:
>
>>> Is it normal that "git commit --amen" actually works ?
>>> (it does like --amend)
>>>
>>> version 1.7.10.4
>>
>> Yes.  From Documentation/technical/api-parse-options.txt:
>>
>>     * Long options may be 'abbreviated', as long as the abbreviation
>>       is unambiguous.
>>
>> Apparently since 2008-06-22.
>
> Notice "technical/api-" part; that is a _wrong_ documentation page
> to quote to end users.
>
> Instead quote from "git help cli".
>
>        From the git 1.5.4 series and further, many git commands (not
>        all of them at the time of the writing though) come with an
>        enhanced option parser.
>
>> So 'git commit --am' also works.  But it should probably be avoided
>> because of its similarity to 'git commit -am'.
>
> Yes, in general, you should avoid relying on shortened form
> working.  Git 2.4 may add an option "--amen" that has totally
> different meaning.

Perhaps a patch along this line might not hurt.

 Documentation/gitcli.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git i/Documentation/gitcli.txt w/Documentation/gitcli.txt
index f6ba90c..3bc1500 100644
--- i/Documentation/gitcli.txt
+++ w/Documentation/gitcli.txt
@@ -93,7 +93,7 @@ ENHANCED OPTION PARSER
 From the git 1.5.4 series and further, many git commands (not all of them at the
 time of the writing though) come with an enhanced option parser.
 
-Here is an exhaustive list of the facilities provided by this option parser.
+Here is a list of the facilities provided by this option parser.
 
 
 Magic Options
@@ -137,6 +137,16 @@ options. This means that you can for example use `git rm -rf` or
 `git clean -fdx`.
 
 
+Abbreviating long options
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Commands that support the enhanced option parser accepts unique
+prefix of a long option as if it is fully spelled out, but use this
+with a caution.  For example, `git commit --amen` behaves as if you
+typed `git commit --amend`, but that is true only until a later version
+of Git introduces another option that shares the same prefix,
+e.g `git commit --amenity" option.
+
+
 Separating argument from the option
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 You can write the mandatory option parameter to an option as a separate

```
