From: Charvi Mendiratta <charvi077@gmail.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git <git@vger.kernel.org>,
Christian Couder <christian.couder@gmail.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Taylor Blau <me@ttaylorr.com>
Subject: Re: How to implement the "amend!" commit ?
Date: Fri, 15 Jan 2021 14:07:16 +0530 [thread overview]
Message-ID: <CAPSFM5f2g2KwSSDQj-6fm67X=gYGSMKarkfrPsNoJJr-UyKyDw@mail.gmail.com> (raw)
In-Reply-To: <99b40665-45dd-6c4d-d46a-56c7dbf89568@gmail.com>
On Thu, 14 Jan 2021 at 16:09, Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> I've taken the liberty of adding some comments about the backwards
> compatibility of each option
>
> On 13/01/2021 01:15, Charvi Mendiratta wrote:
> > Hi Everyone,
> >
> > Implementing "amend!" commit would be an alternative to the
> > fixup!/squash! commit that addresses the issue as opened here[1]. Also
> > the related patches[2], adds the options to `fixup` command in
> > interactive rebase and supports the "amend!" commit upon
> > `--autosquash`. Next, after discussing with Phillip and Christian,
> > there could be 3 possibilities to implement the "amend!" commit (UI):
> >
> > Firstly, the `--fixup=<commit>` to have option like,
> > `--fixup=reword/amend:<commit>`
> >
> > So, `git commit --fixup` can have 3 options:
> >
> > a) `--fixup=<commit>`, work as of now, make fixup! commit.
> > b) `--fixup=amend:<commit>`, make "amend!" commit, takes changes and
> > also opens the editor for a new message (Here it adds a new message to
> > amend! commit's message body and upon autosquash it will fixup up the
> > content and reword the original commit message i.e replaces the
> > original commit message with the "amend!" commit's message).
> > c) `--fixup=reword:<commit>`, makes (empty) "amend!" commit, do not
> > take changes and open the editor for a new message(Here, upon
> > autosquash it will just reword the original commit message).
>
> This is the only option that is backwards compatible. `--fixup=:/<text>
> ` still works and can be used with the new syntax as
> `--fixup=amend::/<text>`. Note that we intend to allow accept any prefix
> of "amend" and "reword" so --fixup=a:<commit> would work.
>
> > Secondly,
> > As an alternative to above, we can use `--fixup=<commit> --amend` and
> > `--fixup=<commit> --reword`.
>
> This is not backwards compatible. At the moment If you create a fixup
> with `git commit --fixup=aaa` and then realize it should refer to commit
> bbb instead you can fix it with `git commit --amend --fixup=bbb`. That
> would no longer be possible. (You could still do `git commit --amend
> -m'fixup! bbb'` which works with `git rebase --autosquash` but is not
> very helpful when running `git log` or `git commit --amend -m"$(git log
> -1 --format=%s bbb)" which is a pain to type.)
I found above, "git commit --amend --fixup=bbb" as one of the hidden
features I had never used before. I also agree to go with first one and
working on the patch to apply it.
Thanks and Regards,
Charvi
>
> > Next,
> > To use only, `--fixup=<commit> --edit` to make the "amend!" commit.
>
> This is not backwards compatible. At the moment this combination of
> options allows the user to add some comments to the fixup commit
> message. To do that in the future they'd have to change the subject line
> when editing the message.
>
> Best Wishes
>
> Phillip
>
> > Also as discussed earlier[3] we are avoiding the use of additional
> > options like `git commit --amend=<commit>` inorder to avoid confusion
> > of doing similar things in different ways. So, I wonder which could be
> > the best way to proceed with or if any other way to implement "amend!"
> > commit ?
> >
> > Thanks and Regards,
> > Charvi
> >
> > [1] https://github.com/gitgitgadget/git/issues/259
> > [2] https://lore.kernel.org/git/20210108092345.2178-1-charvi077@gmail.com/
> > [3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/
> >
>
prev parent reply other threads:[~2021-01-15 8:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAPSFM5c2iqBn8_Dih2id7q6RRp0q=vfCSVUHDE5AOXZ8z3Ko9w@mail.gmail.com>
2021-01-13 1:15 ` How to implement the "amend!" commit ? Charvi Mendiratta
2021-01-13 18:24 ` Taylor Blau
2021-01-13 18:27 ` Taylor Blau
2021-01-14 8:06 ` Charvi Mendiratta
2021-01-14 10:39 ` Phillip Wood
2021-01-14 17:32 ` Taylor Blau
2021-01-15 10:42 ` Phillip Wood
2021-01-15 18:05 ` Martin Ågren
2021-01-14 20:32 ` Junio C Hamano
2021-01-15 10:29 ` Phillip Wood
2021-01-15 17:23 ` Junio C Hamano
2021-01-17 3:43 ` Charvi Mendiratta
2021-01-17 4:33 ` Junio C Hamano
2021-01-17 7:46 ` Charvi Mendiratta
2021-01-15 8:37 ` Charvi Mendiratta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPSFM5f2g2KwSSDQj-6fm67X=gYGSMKarkfrPsNoJJr-UyKyDw@mail.gmail.com' \
--to=charvi077@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=phillip.wood123@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).