{"thread":{"id":"54980","subject":"How to implement the \"amend!\" commit ?","startedAt":"2021-01-13T01:16:21Z","lastAt":"2021-01-17T07:47:48Z","messageCount":15,"participants":["Charvi Mendiratta","Taylor Blau","Phillip Wood","Junio C Hamano","Martin Ågren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"414240","messageId":"CAPSFM5f+cm87N5TO3V+rJvWyrcazybNb_Zu_bJZ+sBH4N4iyow@mail.gmail.com","threadId":"54980","inReplyTo":"CAPSFM5c2iqBn8_Dih2id7q6RRp0q=vfCSVUHDE5AOXZ8z3Ko9w@mail.gmail.com","subject":"How to implement the \"amend!\" commit ?","fromName":"Charvi Mendiratta","fromEmail":"charvi077@gmail.com","sentAt":"2021-01-13T01:15:25Z","receivedAt":"2021-01-13T01:16:21Z","isPatch":false,"sender":{"key":"charvi077@gmail.com","avatar":"https://avatars.githubusercontent.com/u/32788121?v=4"},"body":"Hi Everyone,\n\nImplementing \"amend!\" commit would be an alternative to the\nfixup!/squash! commit that addresses the issue as opened here[1]. Also\nthe related patches[2], adds the options to `fixup` command in\ninteractive rebase and supports the \"amend!\" commit upon\n`--autosquash`. Next, after discussing with Phillip and Christian,\nthere could be 3 possibilities to implement the \"amend!\" commit (UI):\n\nFirstly, the `--fixup=<commit>` to have option like,\n`--fixup=reword/amend:<commit>`\n\nSo, `git commit --fixup` can have 3 options:\n\na) `--fixup=<commit>`, work as of now, make fixup! commit.\nb) `--fixup=amend:<commit>`, make \"amend!\" commit, takes changes and\nalso opens the editor for a new message (Here it adds a new message to\namend! commit's message body and upon autosquash it will fixup up the\ncontent and reword the original commit message i.e replaces the\noriginal commit message with the \"amend!\" commit's message).\nc) `--fixup=reword:<commit>`, makes (empty) \"amend!\" commit, do not\ntake changes and open the editor for a new message(Here, upon\nautosquash it will just reword the original commit message).\n\nSecondly,\nAs an alternative to above, we can use `--fixup=<commit> --amend` and\n`--fixup=<commit> --reword`.\n\nNext,\nTo use only, `--fixup=<commit> --edit` to make the \"amend!\" commit.\n\nAlso as discussed earlier[3] we are avoiding the use of additional\noptions like `git commit --amend=<commit>` inorder to avoid confusion\nof doing similar things in different ways. So, I wonder which could be\nthe best way to proceed with or if any other way to implement \"amend!\"\ncommit ?\n\nThanks and Regards,\nCharvi\n\n[1] https://github.com/gitgitgadget/git/issues/259\n[2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/\n[3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/\n"},{"id":"414276","messageId":"X/864HdPtf1km0xZ@nand.local","threadId":"54980","inReplyTo":"CAPSFM5f+cm87N5TO3V+rJvWyrcazybNb_Zu_bJZ+sBH4N4iyow@mail.gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-01-13T18:24:32Z","receivedAt":"2021-01-13T18:25:34Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"Hi Chavri,\n\nOn Wed, Jan 13, 2021 at 06:45:25AM +0530, Charvi Mendiratta wrote:\n> Hi Everyone,\n>\n> Implementing \"amend!\" commit would be an alternative to the\n> fixup!/squash! commit that addresses the issue as opened here[1]. Also\n> the related patches[2], adds the options to `fixup` command in\n> interactive rebase and supports the \"amend!\" commit upon\n> `--autosquash`. Next, after discussing with Phillip and Christian,\n> there could be 3 possibilities to implement the \"amend!\" commit (UI):\n\nTo make sure that I'm understanding correctly:\n\n  - Your series in [2] teaches the rebase directive 'fixup' two new\n    options: -C, and -c. Unlike of the option-less 'fixup' command,\n    these new options use the message from the fixup commit instead of\n    the original.\n\n    If I'm understanding correctly, this old-style sequence:\n\n        pick aaaaaaaaaa original\n        fixup bbbbbbbbbb fixup! new\n        exec git commit --amend -C bbbbbbbbbb --no-edit\n\n    should be equivalent to this one:\n\n        pick aaaaaaaaaa original\n        fixup -C bbbbbbbbbb fixup! new\n\n  - Separate from that, you are asking about how to implement an\n    \"amend!\" commit which would behave exactly as the 'fixup -C' variant\n    that you are proposing.\n\nWe should clarify what you mean by \"implement\". I take it from the\nremainder of your message that you are really asking about how we should\n_expose_ this new 'fixup -C' command to users.\n\n> Firstly, the `--fixup=<commit>` to have option like,\n> `--fixup=reword/amend:<commit>`\n>\n> So, `git commit --fixup` can have 3 options:\n>\n> a) `--fixup=<commit>`, work as of now, make fixup! commit.\n> b) `--fixup=amend:<commit>`, make \"amend!\" commit, takes changes and\n> also opens the editor for a new message (Here it adds a new message to\n> amend! commit's message body and upon autosquash it will fixup up the\n> content and reword the original commit message i.e replaces the\n> original commit message with the \"amend!\" commit's message).\n> c) `--fixup=reword:<commit>`, makes (empty) \"amend!\" commit, do not\n> take changes and open the editor for a new message(Here, upon\n> autosquash it will just reword the original commit message).\n\nI think that this trio is a good path forward, but...\n`--fixup` behaving as it always has, which is good. Then it makes\n`--fixup=amend:<commit>` insert a 'fixup -C', and `--fixup=reword:<...>`\ninsert a 'fixup -c'.\n\n> Secondly,\n> As an alternative to above, we can use `--fixup=<commit> --amend` and\n> `--fixup=<commit> --reword`.\n\n...I think that this option is even better.\n\nHere '--fixup=<commit>' with '--amend' inserts a 'fixup -C' sequencer\ncomamnd, and using the same instead with '--reword' inserts a 'fixup -c'\nsequencer command.\n\nThis is clear to me because '--fixup' makes a commit that is interpreted\nseparately by the sequencer machinery, so any options that are given\nwith it seem to indicate that they will alter how the sequencer\ninterprets the resulting commit, which makes sense.\n\nOf course, it's all somewhat confusing because you have to keep track of\nwhich are options to 'git commit', and which are sequencer commands, but\nI like the direction that you're going in here.\n\n> Next,\n> To use only, `--fixup=<commit> --edit` to make the \"amend!\" commit.\n\nI don't think that this is as good a direction forward.\n\n> Also as discussed earlier[3] we are avoiding the use of additional\n> options like `git commit --amend=<commit>` inorder to avoid confusion\n> of doing similar things in different ways. So, I wonder which could be\n> the best way to proceed with or if any other way to implement \"amend!\"\n> commit ?\n>\n> Thanks and Regards,\n> Charvi\n>\n> [1] https://github.com/gitgitgadget/git/issues/259\n> [2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/\n> [3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/\n\nThanks,\nTaylor\n"},{"id":"414277","messageId":"X/87r7+dcYzzcus+@nand.local","threadId":"54980","inReplyTo":"X/864HdPtf1km0xZ@nand.local","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-01-13T18:27:59Z","receivedAt":"2021-01-13T18:29:01Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Wed, Jan 13, 2021 at 01:24:32PM -0500, Taylor Blau wrote:\n> I think that this trio is a good path forward, but...\n> `--fixup` behaving as it always has, which is good. Then it makes\n> `--fixup=amend:<commit>` insert a 'fixup -C', and `--fixup=reword:<...>`\n> insert a 'fixup -c'.\n\nOops. Ignore everything after the 'but...' until the next '...' below.\n\nThanks,\nTaylor\n"},{"id":"414338","messageId":"CAPSFM5c=BT2S_32FrfFO7x1EONgaRE0C_TREhaYZVi8F=oj17g@mail.gmail.com","threadId":"54980","inReplyTo":"X/864HdPtf1km0xZ@nand.local","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Charvi Mendiratta","fromEmail":"charvi077@gmail.com","sentAt":"2021-01-14T08:06:07Z","receivedAt":"2021-01-14T08:07:28Z","isPatch":false,"sender":{"key":"charvi077@gmail.com","avatar":"https://avatars.githubusercontent.com/u/32788121?v=4"},"body":"Hi Taylor,\n\nOn Wed, 13 Jan 2021 at 23:54, Taylor Blau <me@ttaylorr.com> wrote:\n>\n> Hi Chavri,\n>\n> On Wed, Jan 13, 2021 at 06:45:25AM +0530, Charvi Mendiratta wrote:\n> > Hi Everyone,\n> >\n> > Implementing \"amend!\" commit would be an alternative to the\n> > fixup!/squash! commit that addresses the issue as opened here[1]. Also\n> > the related patches[2], adds the options to `fixup` command in\n> > interactive rebase and supports the \"amend!\" commit upon\n> > `--autosquash`. Next, after discussing with Phillip and Christian,\n> > there could be 3 possibilities to implement the \"amend!\" commit (UI):\n>\n> To make sure that I'm understanding correctly:\n>\n>   - Your series in [2] teaches the rebase directive 'fixup' two new\n>     options: -C, and -c. Unlike of the option-less 'fixup' command,\n>     these new options use the message from the fixup commit instead of\n>     the original.\n>\n>     If I'm understanding correctly, this old-style sequence:\n>\n>         pick aaaaaaaaaa original\n>         fixup bbbbbbbbbb fixup! new\n>         exec git commit --amend -C bbbbbbbbbb --no-edit\n>\n>     should be equivalent to this one:\n>\n>         pick aaaaaaaaaa original\n>         fixup -C bbbbbbbbbb fixup! new\n>\n\nYes, `fixup -C ` works the same as above.\n\n>   - Separate from that, you are asking about how to implement an\n>     \"amend!\" commit which would behave exactly as the 'fixup -C' variant\n>     that you are proposing.\n>\n> We should clarify what you mean by \"implement\". I take it from the\n> remainder of your message that you are really asking about how we should\n> _expose_ this new 'fixup -C' command to users.\n>\n\nI apologize for the confusion. But yes you got right, by using\n\"implement\" I mean to ask regarding the user interface for \"amend!\"\ncommit. So, if we choose to go with adding additional arguments like ,\n`git commit --fixup= --amend`, then it will create a new \"amend!\"\ncommit and in sequencer it will insert fixup -C, upon `git rebase -i\n--autosquash`.\n\n> > Firstly, the `--fixup=<commit>` to have option like,\n> > `--fixup=reword/amend:<commit>`\n> >\n> > So, `git commit --fixup` can have 3 options:\n> >\n> > a) `--fixup=<commit>`, work as of now, make fixup! commit.\n> > b) `--fixup=amend:<commit>`, make \"amend!\" commit, takes changes and\n> > also opens the editor for a new message (Here it adds a new message to\n> > amend! commit's message body and upon autosquash it will fixup up the\n> > content and reword the original commit message i.e replaces the\n> > original commit message with the \"amend!\" commit's message).\n> > c) `--fixup=reword:<commit>`, makes (empty) \"amend!\" commit, do not\n> > take changes and open the editor for a new message(Here, upon\n> > autosquash it will just reword the original commit message).\n>\n> I think that this trio is a good path forward, but...\n> `--fixup` behaving as it always has, which is good. Then it makes\n> `--fixup=amend:<commit>` insert a 'fixup -C', and `--fixup=reword:<...>`\n> insert a 'fixup -c'.\n>\n> > Secondly,\n> > As an alternative to above, we can use `--fixup=<commit> --amend` and\n> > `--fixup=<commit> --reword`.\n>\n> ...I think that this option is even better.\n>\n> Here '--fixup=<commit>' with '--amend' inserts a 'fixup -C' sequencer\n> comamnd, and using the same instead with '--reword' inserts a 'fixup -c'\n> sequencer command.\n>\n\nI think this would be a bit different. Here both the `--fixup=<commit>\n--amend` and `--fixup=<commit> --reword` would create a new \"amend!\"\ncommit and at the same time also opens the editor for a new commit\nmessage. And in the sequencer both insert \"fixup -C\".  So, here for\n'--reword', 'fixup -c' is not used in sequencer upon --autosquash, as\nwe need to open the editor only one time while `git commit\n--fixup=<commit> --reword` and works as an alternative to \"squash!\"\ncommit that opens the editor both the time.\n\nAnd, the major difference is that \" --fixup=<commit> --amend\" would\ntake both changes and also let the user change the commit message. On\nthe other hand \"--fixup=<commit> --reword\" will not take any changes\nand only let the user to change the commit message. (So, we don't need\nto add additional --allow-empty as we do now).\n\nI also think that the above thing can be a bit confusing and I would\nbe happy to do more improvements or suggestions to implement\nit in a more user friendly way.\n\n> This is clear to me because '--fixup' makes a commit that is interpreted\n> separately by the sequencer machinery, so any options that are given\n> with it seem to indicate that they will alter how the sequencer\n> interprets the resulting commit, which makes sense.\n>\n> Of course, it's all somewhat confusing because you have to keep track of\n> which are options to 'git commit', and which are sequencer commands, but\n> I like the direction that you're going in here.\n>\n> > Next,\n> > To use only, `--fixup=<commit> --edit` to make the \"amend!\" commit.\n>\n> I don't think that this is as good a direction forward.\n>\n\nI agree, thanks.\n\nThanks and Regards,\nCharvi\n\n> > Also as discussed earlier[3] we are avoiding the use of additional\n> > options like `git commit --amend=<commit>` inorder to avoid confusion\n> > of doing similar things in different ways. So, I wonder which could be\n> > the best way to proceed with or if any other way to implement \"amend!\"\n> > commit ?\n> >\n> > Thanks and Regards,\n> > Charvi\n> >\n> > [1] https://github.com/gitgitgadget/git/issues/259\n> > [2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/\n> > [3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/\n>\n> Thanks,\n> Taylor\n"},{"id":"414349","messageId":"99b40665-45dd-6c4d-d46a-56c7dbf89568@gmail.com","threadId":"54980","inReplyTo":"CAPSFM5f+cm87N5TO3V+rJvWyrcazybNb_Zu_bJZ+sBH4N4iyow@mail.gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-01-14T10:39:50Z","receivedAt":"2021-01-14T10:41:24Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"I've taken the liberty of adding some comments about the backwards \ncompatibility of each option\n\nOn 13/01/2021 01:15, Charvi Mendiratta wrote:\n> Hi Everyone,\n> \n> Implementing \"amend!\" commit would be an alternative to the\n> fixup!/squash! commit that addresses the issue as opened here[1]. Also\n> the related patches[2], adds the options to `fixup` command in\n> interactive rebase and supports the \"amend!\" commit upon\n> `--autosquash`. Next, after discussing with Phillip and Christian,\n> there could be 3 possibilities to implement the \"amend!\" commit (UI):\n> \n> Firstly, the `--fixup=<commit>` to have option like,\n> `--fixup=reword/amend:<commit>`\n> \n> So, `git commit --fixup` can have 3 options:\n> \n> a) `--fixup=<commit>`, work as of now, make fixup! commit.\n> b) `--fixup=amend:<commit>`, make \"amend!\" commit, takes changes and\n> also opens the editor for a new message (Here it adds a new message to\n> amend! commit's message body and upon autosquash it will fixup up the\n> content and reword the original commit message i.e replaces the\n> original commit message with the \"amend!\" commit's message).\n> c) `--fixup=reword:<commit>`, makes (empty) \"amend!\" commit, do not\n> take changes and open the editor for a new message(Here, upon\n> autosquash it will just reword the original commit message).\n\nThis is the only option that is backwards compatible. `--fixup=:/<text> \n` still works and can be used with the new syntax as \n`--fixup=amend::/<text>`. Note that we intend to allow accept any prefix \nof \"amend\" and \"reword\" so --fixup=a:<commit> would work.\n\n> Secondly,\n> As an alternative to above, we can use `--fixup=<commit> --amend` and\n> `--fixup=<commit> --reword`.\n\nThis is not backwards compatible. At the moment If you create a fixup \nwith `git commit --fixup=aaa` and then realize it should refer to commit \nbbb instead you can fix it with `git commit --amend --fixup=bbb`. That \nwould no longer be possible. (You could still do `git commit --amend \n-m'fixup! bbb'` which works with `git rebase --autosquash` but is not \nvery helpful when running `git log` or `git commit --amend -m\"$(git log \n-1 --format=%s bbb)\" which is a pain to type.)\n\n> Next,\n> To use only, `--fixup=<commit> --edit` to make the \"amend!\" commit.\n\nThis is not backwards compatible. At the moment this combination of \noptions allows the user to add some comments to the fixup commit \nmessage. To do that in the future they'd have to change the subject line \nwhen editing the message.\n\nBest Wishes\n\nPhillip\n\n> Also as discussed earlier[3] we are avoiding the use of additional\n> options like `git commit --amend=<commit>` inorder to avoid confusion\n> of doing similar things in different ways. So, I wonder which could be\n> the best way to proceed with or if any other way to implement \"amend!\"\n> commit ?\n> \n> Thanks and Regards,\n> Charvi\n> \n> [1] https://github.com/gitgitgadget/git/issues/259\n> [2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/\n> [3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/\n> \n\n"},{"id":"414366","messageId":"YACAHdDEMIgvQruK@nand.local","threadId":"54980","inReplyTo":"99b40665-45dd-6c4d-d46a-56c7dbf89568@gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-01-14T17:32:13Z","receivedAt":"2021-01-14T17:32:59Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Thu, Jan 14, 2021 at 10:39:50AM +0000, Phillip Wood wrote:\n> > Secondly, As an alternative to above, we can use `--fixup=<commit>\n> > --amend` and `--fixup=<commit> --reword`.\n>\n> This is not backwards compatible. At the moment If you create a fixup with\n> `git commit --fixup=aaa` and then realize it should refer to commit bbb\n> instead you can fix it with `git commit --amend --fixup=bbb`. That would no\n> longer be possible.\n\nToo bad. I felt that this was the most ergonomic idea put forwards, but\nI also thought that we died with '--amend --fixup=xxx'. Its current\nbehavior does make sense to me, but it's too bad that we can't use it\nfor this new purpose.\n\nI suppose the first option (the '--fixup=reword:xxx' one really is the\nonly one that can be implemented while preserving backwards\ncompatibility, so I think we have no choice but to go with that one.)\n\nThanks,\nTaylor\n"},{"id":"414388","messageId":"xmqq7dofxnru.fsf@gitster.c.googlers.com","threadId":"54980","inReplyTo":"99b40665-45dd-6c4d-d46a-56c7dbf89568@gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-14T20:32:37Z","receivedAt":"2021-01-14T20:33:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> This is the only option that is backwards\n> compatible. `--fixup=:/<text> ` still works and can be used with the\n> new syntax as `--fixup=amend::/<text>`.\n\nDo you mean both \"--fixup=:/<text>\" and \"--fixup=amend::/<text>\"\nwork and do the same thing?  If so, that is good.\n\n> Note that we intend to allow\n> accept any prefix of \"amend\" and \"reword\" so --fixup=a:<commit> would\n> work.\n\n\"a\" and \"r\" may happen to be unique but we would not want to be\nlimited to these two forever---future developers are allowed to\ninvent other clever variants.  So let's say \"accept unique prefix as\nabbreviation for these operating mode words like 'amend' and 'reword'\"\n\n"},{"id":"414436","messageId":"CAPSFM5f2g2KwSSDQj-6fm67X=gYGSMKarkfrPsNoJJr-UyKyDw@mail.gmail.com","threadId":"54980","inReplyTo":"99b40665-45dd-6c4d-d46a-56c7dbf89568@gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Charvi Mendiratta","fromEmail":"charvi077@gmail.com","sentAt":"2021-01-15T08:37:16Z","receivedAt":"2021-01-15T08:38:27Z","isPatch":false,"sender":{"key":"charvi077@gmail.com","avatar":"https://avatars.githubusercontent.com/u/32788121?v=4"},"body":"On Thu, 14 Jan 2021 at 16:09, Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> I've taken the liberty of adding some comments about the backwards\n> compatibility of each option\n>\n> On 13/01/2021 01:15, Charvi Mendiratta wrote:\n> > Hi Everyone,\n> >\n> > Implementing \"amend!\" commit would be an alternative to the\n> > fixup!/squash! commit that addresses the issue as opened here[1]. Also\n> > the related patches[2], adds the options to `fixup` command in\n> > interactive rebase and supports the \"amend!\" commit upon\n> > `--autosquash`. Next, after discussing with Phillip and Christian,\n> > there could be 3 possibilities to implement the \"amend!\" commit (UI):\n> >\n> > Firstly, the `--fixup=<commit>` to have option like,\n> > `--fixup=reword/amend:<commit>`\n> >\n> > So, `git commit --fixup` can have 3 options:\n> >\n> > a) `--fixup=<commit>`, work as of now, make fixup! commit.\n> > b) `--fixup=amend:<commit>`, make \"amend!\" commit, takes changes and\n> > also opens the editor for a new message (Here it adds a new message to\n> > amend! commit's message body and upon autosquash it will fixup up the\n> > content and reword the original commit message i.e replaces the\n> > original commit message with the \"amend!\" commit's message).\n> > c) `--fixup=reword:<commit>`, makes (empty) \"amend!\" commit, do not\n> > take changes and open the editor for a new message(Here, upon\n> > autosquash it will just reword the original commit message).\n>\n> This is the only option that is backwards compatible. `--fixup=:/<text>\n> ` still works and can be used with the new syntax as\n> `--fixup=amend::/<text>`. Note that we intend to allow accept any prefix\n> of \"amend\" and \"reword\" so --fixup=a:<commit> would work.\n>\n> > Secondly,\n> > As an alternative to above, we can use `--fixup=<commit> --amend` and\n> > `--fixup=<commit> --reword`.\n>\n> This is not backwards compatible. At the moment If you create a fixup\n> with `git commit --fixup=aaa` and then realize it should refer to commit\n> bbb instead you can fix it with `git commit --amend --fixup=bbb`. That\n> would no longer be possible. (You could still do `git commit --amend\n> -m'fixup! bbb'` which works with `git rebase --autosquash` but is not\n> very helpful when running `git log` or `git commit --amend -m\"$(git log\n> -1 --format=%s bbb)\" which is a pain to type.)\n\nI found above, \"git commit --amend --fixup=bbb\" as one of the hidden\nfeatures I had never used before. I also agree to go with first one and\nworking on the patch to apply it.\n\nThanks and Regards,\nCharvi\n\n>\n> > Next,\n> > To use only, `--fixup=<commit> --edit` to make the \"amend!\" commit.\n>\n> This is not backwards compatible. At the moment this combination of\n> options allows the user to add some comments to the fixup commit\n> message. To do that in the future they'd have to change the subject line\n> when editing the message.\n>\n> Best Wishes\n>\n> Phillip\n>\n> > Also as discussed earlier[3] we are avoiding the use of additional\n> > options like `git commit --amend=<commit>` inorder to avoid confusion\n> > of doing similar things in different ways. So, I wonder which could be\n> > the best way to proceed with or if any other way to implement \"amend!\"\n> > commit ?\n> >\n> > Thanks and Regards,\n> > Charvi\n> >\n> > [1] https://github.com/gitgitgadget/git/issues/259\n> > [2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/\n> > [3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/\n> >\n>\n"},{"id":"414448","messageId":"81d3784c-fa64-a18d-9cc8-6ff50bbdd6ac@gmail.com","threadId":"54980","inReplyTo":"xmqq7dofxnru.fsf@gitster.c.googlers.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-01-15T10:29:26Z","receivedAt":"2021-01-15T10:30:15Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Junio\n\nOn 14/01/2021 20:32, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> This is the only option that is backwards\n>> compatible. `--fixup=:/<text> ` still works and can be used with the\n>> new syntax as `--fixup=amend::/<text>`.\n> Do you mean both \"--fixup=:/<text>\" and \"--fixup=amend::/<text>\"\n> work and do the same thing?  If so, that is good.\n\n\"--fixup=:/<text>\" will work as it does now and \"--fixup=amend::/<text>\" \nwill create an amend! commit.\n\n>> Note that we intend to allow\n>> accept any prefix of \"amend\" and \"reword\" so --fixup=a:<commit> would\n>> work.\n> \n> \"a\" and \"r\" may happen to be unique but we would not want to be\n> limited to these two forever---future developers are allowed to\n> invent other clever variants.  So let's say \"accept unique prefix as\n> abbreviation for these operating mode words like 'amend' and 'reword'\"\n\nSure - that's actually what I meant but I wasn't very clear\n\nDo you think we want to support \"--fixup=squash:<commit>\" so there is a \nuniform way for creating all flavors or is that just going to be \nconfusing when we have \"--squash=<commit>\" already?\n\nBest Wishes\n\nPhillip\n"},{"id":"414449","messageId":"0236bb58-61a7-6126-b50f-93e8b6bf3aef@gmail.com","threadId":"54980","inReplyTo":"YACAHdDEMIgvQruK@nand.local","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-01-15T10:42:48Z","receivedAt":"2021-01-15T10:43:52Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Taylor\n\nOn 14/01/2021 17:32, Taylor Blau wrote:\n> On Thu, Jan 14, 2021 at 10:39:50AM +0000, Phillip Wood wrote:\n>>> Secondly, As an alternative to above, we can use `--fixup=<commit>\n>>> --amend` and `--fixup=<commit> --reword`.\n>>\n>> This is not backwards compatible. At the moment If you create a fixup with\n>> `git commit --fixup=aaa` and then realize it should refer to commit bbb\n>> instead you can fix it with `git commit --amend --fixup=bbb`. That would no\n>> longer be possible.\n> \n> Too bad. I felt that this was the most ergonomic idea put forwards, but\n> I also thought that we died with '--amend --fixup=xxx'. Its current\n> behavior does make sense to me, but it's too bad that we can't use it\n> for this new purpose.\n\nI guess we could decide to change the behavior but I'm not sure there is \na sufficiently compelling reason to do that. I agree the current \nbehavior makes sense but (based on no data at all) I'm not sure that it \nis used very much. One thing I like about this option is that it is much \neasier to create an alias to create a particular type of fixup, with \n--fixup=amend:<commit> you have to use a shell function alias to do \nthat. The down side of re-purposing \"--amend\" is that it no longer \nalways rewrites HEAD which is potentially confusing.\n\n> I suppose the first option (the '--fixup=reword:xxx' one really is the\n> only one that can be implemented while preserving backwards\n> compatibility, so I think we have no choice but to go with that one.)\n\nI agree, to me it feels a bit more cumbersome, but on the plus side I \nthink it is arguably clearer than re-purposing '--fixup=<commit> \n--amend' and it is slightly less typing than specifying two options as well.\n\nThanks for your comments on this series\n\nBest Wishes\n\nPhillip\n\n> Thanks,\n> Taylor\n> \n"},{"id":"414459","messageId":"xmqq7doet8qe.fsf@gitster.c.googlers.com","threadId":"54980","inReplyTo":"81d3784c-fa64-a18d-9cc8-6ff50bbdd6ac@gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-15T17:23:21Z","receivedAt":"2021-01-15T17:24:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> \"--fixup=:/<text>\" will work as it does now and\n> \"--fixup=amend::/<text>\" will create an amend! commit.\n\nOK.  That sounds good.\n\nThanks.\n"},{"id":"414460","messageId":"CAN0heSqnaOi+2k_2mtKBW4wPoGSZ=nAkt1wQaeocgKy9s7b45g@mail.gmail.com","threadId":"54980","inReplyTo":"0236bb58-61a7-6126-b50f-93e8b6bf3aef@gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-15T18:05:05Z","receivedAt":"2021-01-15T18:05:58Z","isPatch":false,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Fri, 15 Jan 2021 at 12:08, Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> On 14/01/2021 17:32, Taylor Blau wrote:\n> > On Thu, Jan 14, 2021 at 10:39:50AM +0000, Phillip Wood wrote:\n> >>> Secondly, As an alternative to above, we can use `--fixup=<commit>\n> >>> --amend` and `--fixup=<commit> --reword`.\n> >>\n> >> This is not backwards compatible. At the moment If you create a fixup with\n> >> `git commit --fixup=aaa` and then realize it should refer to commit bbb\n> >> instead you can fix it with `git commit --amend --fixup=bbb`. That would no\n> >> longer be possible.\n> >\n> > Too bad. I felt that this was the most ergonomic idea put forwards, but\n> > I also thought that we died with '--amend --fixup=xxx'. Its current\n> > behavior does make sense to me, but it's too bad that we can't use it\n> > for this new purpose.\n>\n> I guess we could decide to change the behavior but I'm not sure there is\n> a sufficiently compelling reason to do that. I agree the current\n> behavior makes sense but (based on no data at all) I'm not sure that it\n> is used very much. [...]\n\nData point: I've done this more than once to correct my choice of which\ncommit to fixup. I'd like to think I'm not very special, so I would\nguess that I'm not the *only one* who has come up with that and found it\nuseful. As for being used \"very much\", no idea.\n\nBut regardless of that, it feels awkward to me to tie those two options\ntogether. That feeling might well correlate with having found that\ncombo to be useful in the first place, though.\n\n\n\nMartin\n"},{"id":"414533","messageId":"CAPSFM5cEnex1xaBy5ia_xNFDNzt5_Y=W-6TB9d9yW_AiPAKxDg@mail.gmail.com","threadId":"54980","inReplyTo":"xmqq7dofxnru.fsf@gitster.c.googlers.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Charvi Mendiratta","fromEmail":"charvi077@gmail.com","sentAt":"2021-01-17T03:43:07Z","receivedAt":"2021-01-17T03:44:28Z","isPatch":false,"sender":{"key":"charvi077@gmail.com","avatar":"https://avatars.githubusercontent.com/u/32788121?v=4"},"body":"Hi Junio and Phillip,\n\nOn Fri, 15 Jan 2021 at 02:02, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>\n[...]\n>\n> > Note that we intend to allow\n> > accept any prefix of \"amend\" and \"reword\" so --fixup=a:<commit> would\n> > work.\n>\n> \"a\" and \"r\" may happen to be unique but we would not want to be\n> limited to these two forever---future developers are allowed to\n> invent other clever variants.  So let's say \"accept unique prefix as\n> abbreviation for these operating mode words like 'amend' and 'reword'\"\n>\n\nEarlier, I thought to implement the UI of amend! commit as :\n\"git commit --fixup=a/amend:<commit>\"\n\nSo users can either use 'a' as abbreviation or 'amend'. But I want to once\nconfirm if I got this right ? As I am doubtful about, what does allowing to\naccept any prefix of \"amend\" and \"reword\" means ?\n\nThanks and Regards,\nCharvi\n"},{"id":"414540","messageId":"xmqq4kjgnpxf.fsf@gitster.c.googlers.com","threadId":"54980","inReplyTo":"CAPSFM5cEnex1xaBy5ia_xNFDNzt5_Y=W-6TB9d9yW_AiPAKxDg@mail.gmail.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-17T04:33:00Z","receivedAt":"2021-01-17T04:36:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Charvi Mendiratta <charvi077@gmail.com> writes:\n\n> Earlier, I thought to implement the UI of amend! commit as :\n> \"git commit --fixup=a/amend:<commit>\"\n>\n> So users can either use 'a' as abbreviation or 'amend'. But I want to once\n> confirm if I got this right ? As I am doubtful about, what does allowing to\n> accept any prefix of \"amend\" and \"reword\" means ?\n\nIt means that all of these do the same thing ...\n\n\tgit commit --fixup=amend:<commit>\n\tgit commit --fixup=amen:<commit>\n\tgit commit --fixup=ame:<commit>\n\tgit commit --fixup=am:<commit>\n\tgit commit --fixup=a:<commit>\n\n... until somebody more brilliant than either of us comes along and\ninvents another operation that sits next to 'amend' and 'reword',\nsay, 'annoy'.  At that point,\n\n\tgit commit --fixup=a:<commit>\n\nno longer uniquely identifies a choice among three ('amend',\n'annoy', or 'reword') and you'd give an error message, but\n\n\tgit commit --fixup=am:<commit>\n\nwill keep working as an abbreviation for \"amend\".\n"},{"id":"414545","messageId":"CAPSFM5eiZF0hqckUyx-Ak0sHs1RYcWEE_Db1G+6i=thhrObj=Q@mail.gmail.com","threadId":"54980","inReplyTo":"xmqq4kjgnpxf.fsf@gitster.c.googlers.com","subject":"Re: How to implement the \"amend!\" commit ?","fromName":"Charvi Mendiratta","fromEmail":"charvi077@gmail.com","sentAt":"2021-01-17T07:46:26Z","receivedAt":"2021-01-17T07:47:48Z","isPatch":false,"sender":{"key":"charvi077@gmail.com","avatar":"https://avatars.githubusercontent.com/u/32788121?v=4"},"body":"Hi Junio,\n\nOn Sun, 17 Jan 2021 at 10:03, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Charvi Mendiratta <charvi077@gmail.com> writes:\n>\n> > Earlier, I thought to implement the UI of amend! commit as :\n> > \"git commit --fixup=a/amend:<commit>\"\n> >\n> > So users can either use 'a' as abbreviation or 'amend'. But I want to once\n> > confirm if I got this right ? As I am doubtful about, what does allowing to\n> > accept any prefix of \"amend\" and \"reword\" means ?\n>\n> It means that all of these do the same thing ...\n>\n>         git commit --fixup=amend:<commit>\n>         git commit --fixup=amen:<commit>\n>         git commit --fixup=ame:<commit>\n>         git commit --fixup=am:<commit>\n>         git commit --fixup=a:<commit>\n>\n> ... until somebody more brilliant than either of us comes along and\n> invents another operation that sits next to 'amend' and 'reword',\n> say, 'annoy'.  At that point,\n>\n>         git commit --fixup=a:<commit>\n>\n> no longer uniquely identifies a choice among three ('amend',\n> 'annoy', or 'reword') and you'd give an error message, but\n>\n>         git commit --fixup=am:<commit>\n>\n> will keep working as an abbreviation for \"amend\".\n\nThanks for explaining, now I can relate with the previous discussions and\nwill look around for the implementation in the above way. I think may be we\ncan do this while parsing the options and checking for the list of prefixes,\nI am not sure but will look into it.\n\nThanks and Regards,\nCharvi\n"}]}