{"thread":{"id":"49149","subject":"[PATCH/RFC] commit: add short option for --amend","startedAt":"2018-08-16T18:31:29Z","lastAt":"2018-08-18T07:27:01Z","messageCount":9,"participants":["Nguyễn Thái Ngọc Duy","Jeff King","Duy Nguyen","Jonathan Nieder","Junio C Hamano","Simon Ruderich"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"355868","messageId":"20180816183117.13716-1-pclouds@gmail.com","threadId":"49149","inReplyTo":null,"subject":"[PATCH/RFC] commit: add short option for --amend","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-08-16T18:31:17Z","receivedAt":"2018-08-16T18:31:29Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"I just realized how often I type \"git ci --amend\". Looking back at my\n~/.bash_history (only 10k lines) this is the second most often git\ncommand I type which may justify a short option for it (assuming that\nother people use this option often too, of course).\n\nThe short option space for 'git commit' is really crowded with\nacCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd\nprefer not to hold shift, so I chose '-j' even though it's not\nstrictly related to \"amend\" (or perhaps we can thinking of amending as\njoining commits).\n\nThoughts?\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/commit.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 213fca2d8e..78f125ba1f 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t\t\t    STATUS_FORMAT_LONG),\n \t\tOPT_BOOL('z', \"null\", &s.null_termination,\n \t\t\t N_(\"terminate entries with NUL\")),\n-\t\tOPT_BOOL(0, \"amend\", &amend, N_(\"amend previous commit\")),\n+\t\tOPT_BOOL('j', \"amend\", &amend, N_(\"amend previous commit\")),\n \t\tOPT_BOOL(0, \"no-post-rewrite\", &no_post_rewrite, N_(\"bypass post-rewrite hook\")),\n \t\t{ 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\" },\n \t\t/* end commit contents options */\n-- \n2.18.0.1004.g6639190530\n\n"},{"id":"355870","messageId":"20180816183903.GA3737@sigill.intra.peff.net","threadId":"49149","inReplyTo":"20180816183117.13716-1-pclouds@gmail.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-08-16T18:39:03Z","receivedAt":"2018-08-16T18:39:06Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:\n\n> I just realized how often I type \"git ci --amend\". Looking back at my\n> ~/.bash_history (only 10k lines) this is the second most often git\n> command I type which may justify a short option for it (assuming that\n> other people use this option often too, of course).\n> \n> The short option space for 'git commit' is really crowded with\n> acCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd\n> prefer not to hold shift, so I chose '-j' even though it's not\n> strictly related to \"amend\" (or perhaps we can thinking of amending as\n> joining commits).\n> \n> Thoughts?\n\nI also used to type it a lot. So I did:\n\n  $ type a\n  a is aliased to `git commit --amend'\n\nI don't know if that argues for or against a short option.\n\n-Peff\n"},{"id":"355873","messageId":"CACsJy8A7hoOGFCnVxTMdySr=8yUP+4tt4hNO6j-VnhKHJDyE7g@mail.gmail.com","threadId":"49149","inReplyTo":"20180816183903.GA3737@sigill.intra.peff.net","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-08-16T18:46:31Z","receivedAt":"2018-08-16T18:53:53Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Aug 16, 2018 at 8:39 PM Jeff King <peff@peff.net> wrote:\n>\n> On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:\n>\n> > I just realized how often I type \"git ci --amend\". Looking back at my\n> > ~/.bash_history (only 10k lines) this is the second most often git\n> > command I type which may justify a short option for it (assuming that\n> > other people use this option often too, of course).\n> >\n> > The short option space for 'git commit' is really crowded with\n> > acCeFhimnopqsStuvz already taken. So it could be '-M' or '-A' but I'd\n> > prefer not to hold shift, so I chose '-j' even though it's not\n> > strictly related to \"amend\" (or perhaps we can thinking of amending as\n> > joining commits).\n> >\n> > Thoughts?\n>\n> I also used to type it a lot. So I did:\n>\n>   $ type a\n>   a is aliased to `git commit --amend'\n>\n> I don't know if that argues for or against a short option.\n\nIt's a \"for\" for me because I won't have my aliases on other people's machines.\n-- \nDuy\n"},{"id":"355893","messageId":"20180817064734.GB131749@aiede.svl.corp.google.com","threadId":"49149","inReplyTo":"20180816183117.13716-1-pclouds@gmail.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-17T06:47:34Z","receivedAt":"2018-08-17T06:47:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n>  \t\t\t    STATUS_FORMAT_LONG),\n>  \t\tOPT_BOOL('z', \"null\", &s.null_termination,\n>  \t\t\t N_(\"terminate entries with NUL\")),\n> -\t\tOPT_BOOL(0, \"amend\", &amend, N_(\"amend previous commit\")),\n> +\t\tOPT_BOOL('j', \"amend\", &amend, N_(\"amend previous commit\")),\n[...]\n> Thoughts?\n\nI'm not a fan.  I would have trouble remembering what the short option\nname means, and it matches the common --jobs option for parallelism\nthat many commands use.  \"git commit --am\" works today already and\ndoesn't run into those problems.\n\nI'm sympathetic to the goal of saving typing, but I'm more sympathetic\nto the goal of making user support easier, which is what makes me end\nup there.\n\nThat said, I've been looking recently at Mercurial's \"hg evolve\"\nextension[1] and I wouldn't be against a well thought out new command\n(e.g. \"git amend\") that does the equivalent of \"git commit --amend\"\nwith some related features.  So I think there are some paths forward\nthat involve abbreviating.\n\nThanks,\nJonathan\n\n[1] https://www.mercurial-scm.org/wiki/EvolveExtension\n"},{"id":"355905","messageId":"CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com","threadId":"49149","inReplyTo":"20180817064734.GB131749@aiede.svl.corp.google.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-08-17T14:33:30Z","receivedAt":"2018-08-17T14:33:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:\n>\n> Nguyễn Thái Ngọc Duy wrote:\n>\n> > --- a/builtin/commit.c\n> > +++ b/builtin/commit.c\n> > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n> >                           STATUS_FORMAT_LONG),\n> >               OPT_BOOL('z', \"null\", &s.null_termination,\n> >                        N_(\"terminate entries with NUL\")),\n> > -             OPT_BOOL(0, \"amend\", &amend, N_(\"amend previous commit\")),\n> > +             OPT_BOOL('j', \"amend\", &amend, N_(\"amend previous commit\")),\n> [...]\n> > Thoughts?\n>\n> I'm not a fan.  I would have trouble remembering what the short option\n> name means, and it matches the common --jobs option for parallelism\n> that many commands use.  \"git commit --am\" works today already and\n> doesn't run into those problems.\n\nThe alternative is -A or -M which may be easier associated with\n--amend. That \"--am\" also would break the moment somebody adds\n--amsomething.\n\n> I'm sympathetic to the goal of saving typing, but I'm more sympathetic\n> to the goal of making user support easier, which is what makes me end\n> up there.\n>\n> That said, I've been looking recently at Mercurial's \"hg evolve\"\n> extension[1] and I wouldn't be against a well thought out new command\n> (e.g. \"git amend\") that does the equivalent of \"git commit --amend\"\n> with some related features.  So I think there are some paths forward\n> that involve abbreviating.\n\nI'm not opposed to a new command like this, but I don't think it\nshould stop us from adding short options.\n-- \nDuy\n"},{"id":"355913","messageId":"20180817152655.GA4816@sigill.intra.peff.net","threadId":"49149","inReplyTo":"CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-08-17T15:26:56Z","receivedAt":"2018-08-17T15:26:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 17, 2018 at 04:33:30PM +0200, Duy Nguyen wrote:\n\n> On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:\n> >\n> > Nguyễn Thái Ngọc Duy wrote:\n> >\n> > > --- a/builtin/commit.c\n> > > +++ b/builtin/commit.c\n> > > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n> > >                           STATUS_FORMAT_LONG),\n> > >               OPT_BOOL('z', \"null\", &s.null_termination,\n> > >                        N_(\"terminate entries with NUL\")),\n> > > -             OPT_BOOL(0, \"amend\", &amend, N_(\"amend previous commit\")),\n> > > +             OPT_BOOL('j', \"amend\", &amend, N_(\"amend previous commit\")),\n> > [...]\n> > > Thoughts?\n> >\n> > I'm not a fan.  I would have trouble remembering what the short option\n> > name means, and it matches the common --jobs option for parallelism\n> > that many commands use.  \"git commit --am\" works today already and\n> > doesn't run into those problems.\n> \n> The alternative is -A or -M which may be easier associated with\n> --amend. That \"--am\" also would break the moment somebody adds\n> --amsomething.\n\nI think \"-A\" has been considered as possibility for matching \"commit -a\"\n/ \"add -A\" in the past, but I had trouble finding past discussion\n(searching for \"A\" in the mailing list is not very productive). It was\nmentioned in 3ba1f11426 (git-add --all: add all files, 2008-07-19), but\nthat was quite a while ago.\n\nNot necessarily a blocker, but something to consider.\n\nLike Jonathan, I do find \"-j\" a little non-intuitive, but I agree that\nmost of the intuitive ones are taken. :)\n\n-Peff\n"},{"id":"355915","messageId":"xmqqa7plc8mj.fsf@gitster-ct.c.googlers.com","threadId":"49149","inReplyTo":"CACsJy8Di4GQLqkBmcnrfmU9aS=wizxU36Ly0BRgDEDmFG=+2Fg@mail.gmail.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-17T15:31:32Z","receivedAt":"2018-08-17T15:31:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> The alternative is -A or -M which may be easier associated with\n> --amend.\n\nI would be confused to mistake that \"git commit -A $args\" would do\nsomething similar to \"git add -A && git commit $args\".\n\nI do my fair share of amends during the day, and I've never felt the\nneed for a short-hand, but perhaps that is just me.  I am wondering\nif \"-E\" (stands for 'edit', not 'A or M are out, and the next letter\nin amend is E') is understandable and memorable enough---after all,\nit is \"editing\" an existing commit, and the edit is done in a big\nand different way than the existing \"commit --edit\".\n\nBut perhaps that reasoning is a bit too cute.  I dunno.\n\n"},{"id":"355916","messageId":"CACsJy8ArEu=AV-eHtTxDOee=SKNL94oxgkrq0eJg5fcggaboNw@mail.gmail.com","threadId":"49149","inReplyTo":"20180817152655.GA4816@sigill.intra.peff.net","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-08-17T15:31:17Z","receivedAt":"2018-08-17T15:31:46Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Aug 17, 2018 at 5:26 PM Jeff King <peff@peff.net> wrote:\n>\n> On Fri, Aug 17, 2018 at 04:33:30PM +0200, Duy Nguyen wrote:\n>\n> > On Fri, Aug 17, 2018 at 8:47 AM Jonathan Nieder <jrnieder@gmail.com> wrote:\n> > >\n> > > Nguyễn Thái Ngọc Duy wrote:\n> > >\n> > > > --- a/builtin/commit.c\n> > > > +++ b/builtin/commit.c\n> > > > @@ -1489,7 +1489,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n> > > >                           STATUS_FORMAT_LONG),\n> > > >               OPT_BOOL('z', \"null\", &s.null_termination,\n> > > >                        N_(\"terminate entries with NUL\")),\n> > > > -             OPT_BOOL(0, \"amend\", &amend, N_(\"amend previous commit\")),\n> > > > +             OPT_BOOL('j', \"amend\", &amend, N_(\"amend previous commit\")),\n> > > [...]\n> > > > Thoughts?\n> > >\n> > > I'm not a fan.  I would have trouble remembering what the short option\n> > > name means, and it matches the common --jobs option for parallelism\n> > > that many commands use.  \"git commit --am\" works today already and\n> > > doesn't run into those problems.\n> >\n> > The alternative is -A or -M which may be easier associated with\n> > --amend. That \"--am\" also would break the moment somebody adds\n> > --amsomething.\n>\n> I think \"-A\" has been considered as possibility for matching \"commit -a\"\n> / \"add -A\" in the past, but I had trouble finding past discussion\n> (searching for \"A\" in the mailing list is not very productive). It was\n> mentioned in 3ba1f11426 (git-add --all: add all files, 2008-07-19), but\n> that was quite a while ago.\n>\n> Not necessarily a blocker, but something to consider.\n>\n> Like Jonathan, I do find \"-j\" a little non-intuitive, but I agree that\n> most of the intuitive ones are taken. :)\n\nOh well. Maybe next time we'll be more careful with adding short\noptions. Consider this patch dropped.\n-- \nDuy\n"},{"id":"355969","messageId":"20180818072450.GA17850@ruderich.org","threadId":"49149","inReplyTo":"20180816183117.13716-1-pclouds@gmail.com","subject":"Re: [PATCH/RFC] commit: add short option for --amend","fromName":"Simon Ruderich","fromEmail":"simon@ruderich.org","sentAt":"2018-08-18T07:24:51Z","receivedAt":"2018-08-18T07:27:01Z","isPatch":true,"sender":{"key":"simon@ruderich.org","avatar":"https://avatars.githubusercontent.com/u/390994?v=4"},"body":"On Thu, Aug 16, 2018 at 08:31:17PM +0200, Nguyễn Thái Ngọc Duy wrote:\n> I just realized how often I type \"git ci --amend\". Looking back at my\n> ~/.bash_history (only 10k lines) this is the second most often git\n> command I type which may justify a short option for it (assuming that\n> other people use this option often too, of course).\n\nWhy not add another alias? As you're already using the ci alias,\nmaybe cia? Personally I have the following aliases for\ncommitting:\n\n        c   = commit --verbose\n        ca  = commit --verbose --amend\n        cad = commit --verbose --amend --date=now\n\nBesides the obvious g=git alias in the shell. I really like one\ncharacter aliases for often used commands/subcommands.\n\nRegards\nSimon\n-- \n+ privacy is necessary\n+ using gnupg http://gnupg.org\n+ public key id: 0x92FEFDB7E44C32F9\n"}]}