Re: [PATCH v3 6/6] doc/git-commit: add documentation for fixup=[amend|reword] options
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 4, 2021, 01:05 UTC
- Message-ID
- <xmqqczwfg23t.fsf@gitster.c.googlers.com>
- In-Reply-To
- <CAPig+cRiiQyavaMGzgBkXOoGFPhMBC7GbpB61ziFMrckReFbcQ@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 10 quoted lines
>> No, as both `amend` and `reword` suboptions create "amend!" commit >> only. I think it seems a bit confusing but I will try another attempt >> to reword the document. > > 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?