git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH/RFC] commit: add short option for --amend
@ 2018-08-16 18:31 Nguyễn Thái Ngọc Duy
  2018-08-16 18:39 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-08-16 18:31 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-16 18:31 [PATCH/RFC] commit: add short option for --amend Nguyễn Thái Ngọc Duy
@ 2018-08-16 18:39 ` Jeff King
  2018-08-16 18:46   ` Duy Nguyen
  2018-08-17  6:47 ` Jonathan Nieder
  2018-08-18  7:24 ` Simon Ruderich
  2 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2018-08-16 18:39 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-16 18:39 ` Jeff King
@ 2018-08-16 18:46   ` Duy Nguyen
  0 siblings, 0 replies; 9+ messages in thread
From: Duy Nguyen @ 2018-08-16 18:46 UTC (permalink / raw)
  To: Jeff King; +Cc: Git Mailing List

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-16 18:31 [PATCH/RFC] commit: add short option for --amend Nguyễn Thái Ngọc Duy
  2018-08-16 18:39 ` Jeff King
@ 2018-08-17  6:47 ` Jonathan Nieder
  2018-08-17 14:33   ` Duy Nguyen
  2018-08-18  7:24 ` Simon Ruderich
  2 siblings, 1 reply; 9+ messages in thread
From: Jonathan Nieder @ 2018-08-17  6:47 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Jeff King

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-17  6:47 ` Jonathan Nieder
@ 2018-08-17 14:33   ` Duy Nguyen
  2018-08-17 15:26     ` Jeff King
  2018-08-17 15:31     ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Duy Nguyen @ 2018-08-17 14:33 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git Mailing List, Jeff King

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-17 14:33   ` Duy Nguyen
@ 2018-08-17 15:26     ` Jeff King
  2018-08-17 15:31       ` Duy Nguyen
  2018-08-17 15:31     ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2018-08-17 15:26 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Jonathan Nieder, Git Mailing List

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-17 15:26     ` Jeff King
@ 2018-08-17 15:31       ` Duy Nguyen
  0 siblings, 0 replies; 9+ messages in thread
From: Duy Nguyen @ 2018-08-17 15:31 UTC (permalink / raw)
  To: Jeff King; +Cc: Jonathan Nieder, Git Mailing List

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-17 14:33   ` Duy Nguyen
  2018-08-17 15:26     ` Jeff King
@ 2018-08-17 15:31     ` Junio C Hamano
  1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2018-08-17 15:31 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Jonathan Nieder, Git Mailing List, Jeff King

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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC] commit: add short option for --amend
  2018-08-16 18:31 [PATCH/RFC] commit: add short option for --amend Nguyễn Thái Ngọc Duy
  2018-08-16 18:39 ` Jeff King
  2018-08-17  6:47 ` Jonathan Nieder
@ 2018-08-18  7:24 ` Simon Ruderich
  2 siblings, 0 replies; 9+ messages in thread
From: Simon Ruderich @ 2018-08-18  7:24 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-08-18  7:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 18:31 [PATCH/RFC] commit: add short option for --amend Nguyễn Thái Ngọc Duy
2018-08-16 18:39 ` Jeff King
2018-08-16 18:46   ` Duy Nguyen
2018-08-17  6:47 ` Jonathan Nieder
2018-08-17 14:33   ` Duy Nguyen
2018-08-17 15:26     ` Jeff King
2018-08-17 15:31       ` Duy Nguyen
2018-08-17 15:31     ` Junio C Hamano
2018-08-18  7:24 ` Simon Ruderich

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).