From: Junio C Hamano <gitster@pobox.com>
To: Pablo Sabater <pabloosabaterr@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Subject: Re: [PATCH RFC 1/2] builtin/history: abort reword on unchanged message
Date: Tue, 09 Jun 2026 06:21:13 -0700 [thread overview]
Message-ID: <xmqqtsrbsvcm.fsf@gitster.g> (raw)
In-Reply-To: <CAN5EUNRW3gyLKGC7x5BBMTNKtunoQks9AaXJse4PHvCziRF87A@mail.gmail.com> (Pablo Sabater's message of "Tue, 9 Jun 2026 12:14:05 +0200")
Pablo Sabater <pabloosabaterr@gmail.com> writes:
> True, after reading it, history being more costly or the in memory are
> not good args.
And no argument, including that history is new, is a good excuse to
make these three things inconsistent, period.
One of the patches in your updated iteration claims
When using `git history reword <commit>` if the new message is the same
as the original, it continues and rewrites the history when nothing
changed.
`git commit --amend` and `git rebase -i` with reword share this behavior
and it is wrong as well, but changing them breaks what people are used
to. Take the opportunity of `git history` being a new command and handle
it correctly from the start.
and I think this is a totally wrong attitude to go about this.
I may have said that it may have been a better default to try hard
to avoid making a change that is a no-op, other than that it changes
committer timestamp, while making the current "always create a new
commit object" behaviour optionally available, for these three
commands, and cited that the behaviour of 'pick' in 'rebase -i' that
avoids unnecessary rewrite as an example of a good practice.
But I do not think the existing behaviour to always rewrite is
*wrong* at all. It may be wrong not to offer the other choice of
pretending no content change means no commit object change, but that
is a different story.
I also do not think *aborting* only when the message happens to be
the same is a valid mode of operation at all.
The most sensible first step, I think, is to add a new command line
option to "git history" (which will gain more history editing
subcommands) that tells the command to leave the original history
as-is when the only change rewriting commits would make would be to
the committer ident or timestamp information. If in a future a new
replace-tree subcommand is added, e.g. if
$ git history replace-tree HEAD~20 HEAD~27^{tree}
were a command to rewrite the history in such a way that 20th direct
ancestor of the current HEAD had a tree object HEAD~27^{tree}, by
derfault the command _should_ rewrite HEAD~10 and everything that
has it as an ancestor. With the "--avoid-unnecsssary-rewrite"
optimization feature on, however, it may silently become a no-op
when HEAD~27^{tree} happened to be the same tree as HEAD~20^{tree}
so the only difference between rewritten and original HEAD~20 would
be when that commit object was created and by whom.
And give the same option to "rebase -i" or "commit --amend". We can
discuss, educate the users, and flip the default at a major version
boundary, if the "avoid unnecessary rewrite" truly turns out to be a
better default (right now it is merely our speculation, and we do
not even know if the current behaviour is a worse default).
next prev parent reply other threads:[~2026-06-09 13:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 20:07 [PATCH RFC 0/2] builtin/history: change git history reword behavior and feedback Pablo Sabater
2026-06-07 20:07 ` [PATCH RFC 1/2] builtin/history: abort reword on unchanged message Pablo Sabater
2026-06-08 9:30 ` Patrick Steinhardt
2026-06-08 10:52 ` Pablo Sabater
2026-06-08 12:16 ` Junio C Hamano
2026-06-08 16:44 ` Ben Knoble
2026-06-09 10:03 ` Pablo Sabater
2026-06-09 10:14 ` Pablo Sabater
2026-06-09 10:30 ` Kristoffer Haugsbakk
2026-06-09 13:21 ` Junio C Hamano [this message]
2026-06-09 15:51 ` Pablo Sabater
2026-06-08 16:37 ` Ben Knoble
2026-06-09 9:59 ` Pablo Sabater
2026-06-07 20:07 ` [PATCH RFC 2/2] builtin/history: print feedback after successful reword Pablo Sabater
2026-06-08 9:30 ` Patrick Steinhardt
2026-06-08 10:45 ` Pablo Sabater
2026-06-08 12:16 ` Junio C Hamano
2026-06-08 13:23 ` Pablo Sabater
2026-06-08 16:47 ` Ben Knoble
2026-06-09 10:42 ` [PATCH RFC v2 0/2] builtin/history: abort reword on same message Pablo Sabater
2026-06-09 10:42 ` [PATCH RFC v2 1/2] builtin/history: refactor function signature Pablo Sabater
2026-06-09 10:42 ` [PATCH RFC v2 2/2] builtin/history: abort reword on same message Pablo Sabater
2026-06-09 13:25 ` Phillip Wood
2026-06-09 16:20 ` Junio C Hamano
2026-06-09 17:12 ` Pablo Sabater
2026-06-09 19:17 ` Junio C Hamano
2026-06-09 18:02 ` Justin Tobler
2026-06-09 19:30 ` Junio C Hamano
2026-06-09 20:14 ` Justin Tobler
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=xmqqtsrbsvcm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kaartic.sivaraam@gmail.com \
--cc=pabloosabaterr@gmail.com \
--cc=ps@pks.im \
/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