Thread (67 messages) 67 messages, 7 authors, 11h ago

Re: [PATCH v5 0/4] history: add squash subcommand to fold a range

From: Patrick Steinhardt <hidden>
Date: 2026-06-29 06:26:58

On Fri, Jun 26, 2026 at 09:52:57AM +0100, Phillip Wood wrote:
Hi Harald

On 24/06/2026 22:54, Harald Nordgren via GitGitGadget wrote:
quoted
Adds git history squash <revision-range> to fold a range of commits.
It would be helpful to give a bit more detail here about the command so that
the reader has an overview of what is actually being implemented.

 - what does it do with fixup!, squash! and amend! commits? Can it use
   the message from amend! commits to reword the commit?
 - can the user reword the commit message?
Good things to document/discuss.
 - what happens if a merge commit inside the range has a parent outside
   the range?
Yeah, I agree that we should punt on merge commits for now. They are a
can of worms, and I'm not sure that we should just squash them. I would
at least like the user to ask a flag that tells us that it's fine
squashing those.
 - what happens to branches that point to commits inside the range?
Yeah, this should be documented indeed.
I had a quick play and found that it accepts ranges that containing a single
commit (e.g. @^!) where there is nothing to squash. It also accepts ranges
that are not ancestors of HEAD (e.g. checkout master and run "git history
squash --dry-run origin/seen^2^!") without printing an error message. Only
accepting a single argument is quite limiting as one cannot say

	git history squash ^:/base :/tip
Note that it is intentional that you can rewrite branches that are not
currently checked out, and the other subcommands work the same. So I'd
argue this should also be the case for "squash".

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help