Re: [PATCH v3 6/6] doc/git-commit: add documentation for fixup=[amend|reword] options
- From
Charvi Mendiratta <charvi077@gmail.com>
- Date
- Mar 4, 2021, 09:00 UTC
- Message-ID
- <CAPSFM5cM4fdyWXD33PkT2bH6kM+3ixkxgAnhjUVYFtjUHgwU5g@mail.gmail.com>
- In-Reply-To
- <xmqqczwfg23t.fsf@gitster.c.googlers.com>
On Thu, 4 Mar 2021 at 06:35, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> > Eric Sunshine <sunshine@sunshineco.com> writes: > > > Hmm, I see. So "reword!" is really just an "amend!" with only commit > > message but no patch content. That makes perfect sense from an > > implementation standpoint, but it makes me wonder if it would be > > easier for users to understand if it created a "reword!" commit which > > would be recognized as an alias of "amend!". (But maybe that's getting > > too confusing, and my musing should be ignored.) > > Perhaps related, perhaps not, but I wonder if we really need --fixup=amend > and --fixup=reword to begin with. The "amend" variant, > > $ git commit --fixup=amend:<original> ... other args ... > > is about shaping the index with "other args" and recording the > resulting tree with the log message taken from <original>, marked > with the "amend!" prefix. The --fixup=reword:<original> variant > is a mere special case of it where the recorded tree is made of the > index in the same way as a partial commit with pathspec that matches > no paths, i.e. If you have --fixup=amend, you can do > > $ git commit --fixup=amend:<original> --only > > and you do not need --fixup=reword:<original> at all, no? >
Maybe as an alternative User interface, we can remove the `--fixup=reword:<original>`.
But for this patch, as we have kept separate suboption `--fixup=reword:<original>` , so if now we do `--fixup=amend:<original> --only` then it will return the error as below : fatal: No paths with --include/--only does not make sense. So, `amend` works only if staged changes are present otherwise to change only the commit message `reword` option is there.
I agree we can change to the above UI but still I wonder which one is more friendly ? Also, I think we need to add complete `--allow-empty --only` to mirror the working of `reword` so this may result in a lot of typing and hard to remember.
Thanks and Regards, Charvi