From: "phillip.wood123@gmail.com" <phillip.wood123@gmail.com>
To: Yuxuan Chen <i@yuxuan.ch>
Cc: "farid.m.zakaria@gmail.com" <farid.m.zakaria@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>,
"gitster@pobox.com" <gitster@pobox.com>,
"newren@gmail.com" <newren@gmail.com>,
"phillip.wood@dunelm.org.uk" <phillip.wood@dunelm.org.uk>,
"ps@pks.im" <ps@pks.im>
Subject: Re: [PATCH] sequencer: honor --empty when a fixup!/squash! empties its target
Date: Mon, 13 Jul 2026 14:18:07 +0100 [thread overview]
Message-ID: <a8d78707-ef0d-439c-ba0a-52a494967046@gmail.com> (raw)
In-Reply-To: <20260710182937.716304-1-i@yuxuan.ch>
Hi Yuxuan
On 10/07/2026 19:30, Yuxuan Chen wrote:
>
>> Using an empty commit has a marker has the advantage that applying it cannot
>> create conflicts, so you only have to deal with the conflicts caused by the
>> commit being dropped, not the by fixup not applying cleanly.
>
> I am concerned, however, that representing a `drop!` commit as an empty marker
> would be semantically unsound. We expect `rebase --autosquash` to drop the
> target commit, but until that rebase happens, the repository is not in a state
> where we consider the target commit dropped: the target's changes are still
> present, and the empty marker changes nothing. Therefore, I think a `drop!`
> commit should contain the inverse of the patch we intend to drop. That way,
> the repository state reflects the intended removal even before autosquash
> rewrites the history.
That's a good point. Looking at the gitgitgadget issue tracker [1],
there is a suggestion to add a new option to revert that behaves like
git revert -n <commit> &&
git commit -m 'drop! '"$(git show -s --oneline <commit>)"
and then "git rebase --autosquash" would replace "pick" with "drop" for
the commit we want to drop and drop the "drop!" commit as well. That
avoids conflicts when dropping the commit and means anything built on
top of the "drop!" commit before the rebase does not see the changes in
the commit that we want to drop because it has been reverted. That seems
to be the best of both worlds.
> I recognize that applying the inverse patch may cause conflicts. However,
> this is not a new problem; `git revert` has the same issue when the inverse
> patch does not apply cleanly. Such conflicts reflect the actual difficulty of
> undoing the change at that point in the history.
I agree conflicts are a fact of life when rebasing, but I think it is
worth avoiding them where we can.
Thanks
Phillip
[1] https://github.com/gitgitgadget/git/issues/259
prev parent reply other threads:[~2026-07-13 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 4:13 [PATCH] sequencer: honor --empty when a fixup!/squash! empties its target Farid Zakaria
2026-07-10 13:28 ` Phillip Wood
2026-07-10 16:42 ` Farid Zakaria
2026-07-10 18:30 ` Yuxuan Chen
2026-07-13 13:18 ` phillip.wood123 [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=a8d78707-ef0d-439c-ba0a-52a494967046@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=farid.m.zakaria@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=i@yuxuan.ch \
--cc=newren@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--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