Re: How to implement the "amend!" commit ?
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jan 15, 2021, 10:42 UTC
- Message-ID
- <0236bb58-61a7-6126-b50f-93e8b6bf3aef@gmail.com>
- In-Reply-To
- <YACAHdDEMIgvQruK@nand.local>
Hi Taylor
On 14/01/2021 17:32, Taylor Blau wrote:
Show 13 quoted lines
> On Thu, Jan 14, 2021 at 10:39:50AM +0000, Phillip Wood wrote: >>> 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. > > Too bad. I felt that this was the most ergonomic idea put forwards, but > I also thought that we died with '--amend --fixup=xxx'. Its current > behavior does make sense to me, but it's too bad that we can't use it > for this new purpose.
I guess we could decide to change the behavior but I'm not sure there is a sufficiently compelling reason to do that. I agree the current behavior makes sense but (based on no data at all) I'm not sure that it is used very much. One thing I like about this option is that it is much easier to create an alias to create a particular type of fixup, with --fixup=amend:<commit> you have to use a shell function alias to do that. The down side of re-purposing "--amend" is that it no longer always rewrites HEAD which is potentially confusing.
> I suppose the first option (the '--fixup=reword:xxx' one really is the > only one that can be implemented while preserving backwards > compatibility, so I think we have no choice but to go with that one.)
I agree, to me it feels a bit more cumbersome, but on the plus side I think it is arguably clearer than re-purposing '--fixup=<commit> --amend' and it is slightly less typing than specifying two options as well.
Thanks for your comments on this series
Best Wishes
Phillip
> Thanks, > Taylor >