# [PATCH/RFC] commit: add short option for --amend

9 messages from 2018-08-16 to 2018-08-18. Participants: Nguyễn Thái Ngọc Duy, Jeff King, Duy Nguyen, Jonathan Nieder, Junio C Hamano, Simon Ruderich.
Thread: https://gitlist.dev/t/49149

## Nguyễn Thái Ngọc Duy, 2018-08-16 18:31

Subject: [PATCH/RFC] commit: add short option for --amend
Message-ID: <20180816183117.13716-1-pclouds@gmail.com>
URL: https://gitlist.dev/e/20180816183117.13716-1-pclouds%40gmail.com

```
I just realized how often I type "git ci --amend". Looking back at my
~/.bash_history (only 10k lines) this is the second most often git
command I type which may justify a short option for it (assuming that
other people use this option often too, of course).

The short option space for 'git commit' is really crowded with
acCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd
prefer not to hold shift, so I chose '-j' even though it's not
strictly related to "amend" (or perhaps we can thinking of amending as
joining commits).

Thoughts?

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 213fca2d8e..78f125ba1f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 			    STATUS_FORMAT_LONG),
 		OPT_BOOL('z', "null", &s.null_termination,
 			 N_("terminate entries with NUL")),
-		OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
+		OPT_BOOL('j', "amend", &amend, N_("amend previous commit")),
 		OPT_BOOL(0, "no-post-rewrite", &no_post_rewrite, N_("bypass post-rewrite hook")),
 		{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, N_("mode"), N_("show untracked files, optional modes: all, normal, no. (Default: all)"), PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
 		/* end commit contents options */
-- 
2.18.0.1004.g6639190530


```

## Jeff King, 2018-08-16 18:39

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <20180816183903.GA3737@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20180816183903.GA3737%40sigill.intra.peff.net
In-Reply-To: <20180816183117.13716-1-pclouds@gmail.com>

```
On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:

> I just realized how often I type "git ci --amend". Looking back at my
> ~/.bash_history (only 10k lines) this is the second most often git
> command I type which may justify a short option for it (assuming that
> other people use this option often too, of course).
> 
> The short option space for 'git commit' is really crowded with
> acCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd
> prefer not to hold shift, so I chose '-j' even though it's not
> strictly related to "amend" (or perhaps we can thinking of amending as
> joining commits).
> 
> Thoughts?

I also used to type it a lot. So I did:

  $ type a
  a is aliased to `git commit --amend'

I don't know if that argues for or against a short option.

-Peff

```

## Duy Nguyen, 2018-08-16 18:46

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <CACsJy8A7hoOGFCnVxTMdySr=8yUP+4tt4hNO6j-VnhKHJDyE7g@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8A7hoOGFCnVxTMdySr%3D8yUP%2B4tt4hNO6j-VnhKHJDyE7g%40mail.gmail.com
In-Reply-To: <20180816183903.GA3737@sigill.intra.peff.net>

```
On Thu, Aug 16, 2018 at 8:39 PM Jeff King <peff@peff.net> wrote:
>
> On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:
>
> > I just realized how often I type "git ci --amend". Looking back at my
> > ~/.bash_history (only 10k lines) this is the second most often git
> > command I type which may justify a short option for it (assuming that
> > other people use this option often too, of course).
> >
> > The short option space for 'git commit' is really crowded with
> > acCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd
> > prefer not to hold shift, so I chose '-j' even though it's not
> > strictly related to "amend" (or perhaps we can thinking of amending as
> > joining commits).
> >
> > Thoughts?
>
> I also used to type it a lot. So I did:
>
>   $ type a
>   a is aliased to `git commit --amend'
>
> I don't know if that argues for or against a short option.

It's a "for" for me because I won't have my aliases on other people's machines.
-- 
Duy

```

## Jonathan Nieder, 2018-08-17 06:47

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <20180817064734.GB131749@aiede.svl.corp.google.com>
URL: https://gitlist.dev/e/20180817064734.GB131749%40aiede.svl.corp.google.com
In-Reply-To: <20180816183117.13716-1-pclouds@gmail.com>

```
Nguyễn Thái Ngọc Duy wrote:

> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>  			    STATUS_FORMAT_LONG),
>  		OPT_BOOL('z', "null", &s.null_termination,
>  			 N_("terminate entries with NUL")),
> -		OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
> +		OPT_BOOL('j', "amend", &amend, N_("amend previous commit")),
[...]
> Thoughts?

I'm not a fan.  I would have trouble remembering what the short option
name means, and it matches the common --jobs option for parallelism
that many commands use.  "git commit --am" works today already and
doesn't run into those problems.

I'm sympathetic to the goal of saving typing, but I'm more sympathetic
to the goal of making user support easier, which is what makes me end
up there.

That said, I've been looking recently at Mercurial's "hg evolve"
extension[1] and I wouldn't be against a well thought out new command
(e.g. "git amend") that does the equivalent of "git commit --amend"
with some related features.  So I think there are some paths forward
that involve abbreviating.

Thanks,
Jonathan

[1] https://www.mercurial-scm.org/wiki/EvolveExtension

```

## Duy Nguyen, 2018-08-17 14:33

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8Di4GQLqkBmcnrfmU9aS%3DwizxU36Ly0BRgDEDmFG%3D%2B2Fg%40mail.gmail.com
In-Reply-To: <20180817064734.GB131749@aiede.svl.corp.google.com>

```
On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:
>
> Nguyễn Thái Ngọc Duy wrote:
>
> > --- a/builtin/commit.c
> > +++ b/builtin/commit.c
> > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
> >                           STATUS_FORMAT_LONG),
> >               OPT_BOOL('z', "null", &s.null_termination,
> >                        N_("terminate entries with NUL")),
> > -             OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
> > +             OPT_BOOL('j', "amend", &amend, N_("amend previous commit")),
> [...]
> > Thoughts?
>
> I'm not a fan.  I would have trouble remembering what the short option
> name means, and it matches the common --jobs option for parallelism
> that many commands use.  "git commit --am" works today already and
> doesn't run into those problems.

The alternative is -A or -M which may be easier associated with
--amend. That "--am" also would break the moment somebody adds
--amsomething.

> I'm sympathetic to the goal of saving typing, but I'm more sympathetic
> to the goal of making user support easier, which is what makes me end
> up there.
>
> That said, I've been looking recently at Mercurial's "hg evolve"
> extension[1] and I wouldn't be against a well thought out new command
> (e.g. "git amend") that does the equivalent of "git commit --amend"
> with some related features.  So I think there are some paths forward
> that involve abbreviating.

I'm not opposed to a new command like this, but I don't think it
should stop us from adding short options.
-- 
Duy

```

## Jeff King, 2018-08-17 15:26

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <20180817152655.GA4816@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20180817152655.GA4816%40sigill.intra.peff.net
In-Reply-To: <CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com>

```
On Fri, Aug 17, 2018 at 04:33:30PM +0200, Duy Nguyen wrote:

> On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:
> >
> > Nguyễn Thái Ngọc Duy wrote:
> >
> > > --- a/builtin/commit.c
> > > +++ b/builtin/commit.c
> > > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
> > >                           STATUS_FORMAT_LONG),
> > >               OPT_BOOL('z', "null", &s.null_termination,
> > >                        N_("terminate entries with NUL")),
> > > -             OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
> > > +             OPT_BOOL('j', "amend", &amend, N_("amend previous commit")),
> > [...]
> > > Thoughts?
> >
> > I'm not a fan.  I would have trouble remembering what the short option
> > name means, and it matches the common --jobs option for parallelism
> > that many commands use.  "git commit --am" works today already and
> > doesn't run into those problems.
> 
> The alternative is -A or -M which may be easier associated with
> --amend. That "--am" also would break the moment somebody adds
> --amsomething.

I think "-A" has been considered as possibility for matching "commit -a"
/ "add -A" in the past, but I had trouble finding past discussion
(searching for "A" in the mailing list is not very productive). It was
mentioned in 3ba1f11426 (git-add --all: add all files, 2008-07-19), but
that was quite a while ago.

Not necessarily a blocker, but something to consider.

Like Jonathan, I do find "-j" a little non-intuitive, but I agree that
most of the intuitive ones are taken. :)

-Peff

```

## Junio C Hamano, 2018-08-17 15:31

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <xmqqa7plc8mj.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqa7plc8mj.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com>

```
Duy Nguyen <pclouds@gmail.com> writes:

> The alternative is -A or -M which may be easier associated with
> --amend.

I would be confused to mistake that "git commit -A $args" would do
something similar to "git add -A && git commit $args".

I do my fair share of amends during the day, and I've never felt the
need for a short-hand, but perhaps that is just me.  I am wondering
if "-E" (stands for 'edit', not 'A or M are out, and the next letter
in amend is E') is understandable and memorable enough---after all,
it is "editing" an existing commit, and the edit is done in a big
and different way than the existing "commit --edit".

But perhaps that reasoning is a bit too cute.  I dunno.


```

## Duy Nguyen, 2018-08-17 15:31

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <CACsJy8ArEu=AV-eHtTxDOee=SKNL94oxgkrq0eJg5fcggaboNw@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8ArEu%3DAV-eHtTxDOee%3DSKNL94oxgkrq0eJg5fcggaboNw%40mail.gmail.com
In-Reply-To: <20180817152655.GA4816@sigill.intra.peff.net>

```
On Fri, Aug 17, 2018 at 5:26 PM Jeff King <peff@peff.net> wrote:
>
> On Fri, Aug 17, 2018 at 04:33:30PM +0200, Duy Nguyen wrote:
>
> > On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:
> > >
> > > Nguyễn Thái Ngọc Duy wrote:
> > >
> > > > --- a/builtin/commit.c
> > > > +++ b/builtin/commit.c
> > > > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
> > > >                           STATUS_FORMAT_LONG),
> > > >               OPT_BOOL('z', "null", &s.null_termination,
> > > >                        N_("terminate entries with NUL")),
> > > > -             OPT_BOOL(0, "amend", &amend, N_("amend previous commit")),
> > > > +             OPT_BOOL('j', "amend", &amend, N_("amend previous commit")),
> > > [...]
> > > > Thoughts?
> > >
> > > I'm not a fan.  I would have trouble remembering what the short option
> > > name means, and it matches the common --jobs option for parallelism
> > > that many commands use.  "git commit --am" works today already and
> > > doesn't run into those problems.
> >
> > The alternative is -A or -M which may be easier associated with
> > --amend. That "--am" also would break the moment somebody adds
> > --amsomething.
>
> I think "-A" has been considered as possibility for matching "commit -a"
> / "add -A" in the past, but I had trouble finding past discussion
> (searching for "A" in the mailing list is not very productive). It was
> mentioned in 3ba1f11426 (git-add --all: add all files, 2008-07-19), but
> that was quite a while ago.
>
> Not necessarily a blocker, but something to consider.
>
> Like Jonathan, I do find "-j" a little non-intuitive, but I agree that
> most of the intuitive ones are taken. :)

Oh well. Maybe next time we'll be more careful with adding short
options. Consider this patch dropped.
-- 
Duy

```

## Simon Ruderich, 2018-08-18 07:24

Subject: Re: [PATCH/RFC] commit: add short option for --amend
Message-ID: <20180818072450.GA17850@ruderich.org>
URL: https://gitlist.dev/e/20180818072450.GA17850%40ruderich.org
In-Reply-To: <20180816183117.13716-1-pclouds@gmail.com>

```
On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:
> I just realized how often I type "git ci --amend". Looking back at my
> ~/.bash_history (only 10k lines) this is the second most often git
> command I type which may justify a short option for it (assuming that
> other people use this option often too, of course).

Why not add another alias? As you're already using the ci alias,
maybe cia? Personally I have the following aliases for
committing:

        c   = commit --verbose
        ca  = commit --verbose --amend
        cad = commit --verbose --amend --date=now

Besides the obvious g=git alias in the shell. I really like one
character aliases for often used commands/subcommands.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

```
