From: phillip.wood123@gmail.com Date: Mon, 13 Jul 2026 13:18:07 GMT Subject: Re: [PATCH] sequencer: honor --empty when a fixup!/squash! empties its target Message-ID: 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 && git commit -m 'drop! '"$(git show -s --oneline )" 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