Re: [PATCH v10 3/5] history: add squash subcommand to fold a range
Phillip Wood <[email protected]> Mon, 3 Aug 2026 10:49:20 +0100
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
From: Phillip Wood <[email protected]> On 20/07/2026 09:27, Harald Nordgren via GitGitGadget wrote: > From: Harald Nordgren <[email protected]> > > Folding a series of commits into one required either an interactive > rebase where each commit after the first was hand-edited to "fixup", or > a "git reset --soft" to the merge base followed by "git commit --amend". > > Add "git history squash <revision-range>" to do this directly. As promised, here are a few suggestions in the form of fixup commits. I've reworked the message generation when it's not being edited, but have not had time to improve the template message when it is being editing. As v11 has come out (despite a suggestion to hold off for a few days[1]) I don't think it worth my while spending more time working off a stale base. Patch 1: clean up the option parsing. Patch 2: checks for BOTTOM rather than UNINTERESTING commits. Patch 3: reject root commits. Patch 4: reject ranges with more than one tip. Patch 5: refuse to squash if there are any branches descended from commits in the squashed range other than the tip of the range. Patch 6: never discard the message from an "amend!" or "squash!" commits. Patch 7: fix squashing a merge. Some of these issues are addressed in v11. The last four patches are the most interesting in terms of improving the behavior and implementation. Besides the difference in the way fixups are handled, the main change is in the way the code is structured to perform a single pass over the commits being squashed, rather than multiple passes for checking the connectivity and generating the commit message. These patches can be fetched with git fetch https://github.com/phillipwood/git wip/hn/history-squash/v10-early-part note that they do not support editing the commit message of the squashed commit. Thanks Phillip [1] https://lore.kernel.org/git/[email protected] Phillip Wood (7): fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range fixup! history: add squash subcommand to fold a range builtin/history.c | 617 +++++++++++++++++++++++--------------- object.h | 1 + t/t3455-history-squash.sh | 385 +++++++++++++++--------- 3 files changed, 623 insertions(+), 380 deletions(-) -- 2.54.0.200.gfd8d68259e3