Files
git/Documentation
Harald Nordgren f4b9baec7a history: add squash subcommand to fold a range
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. It folds
every commit in the range into the oldest one, keeping that commit's
message and authorship and taking the tree of the newest commit, so the
range collapses into a single commit. Commits above the range are
replayed on top of the result.

The range is given as <base>..<tip>, so "git history squash @~3.."
folds the three most recent commits and "git history squash @~5..@~2"
squashes an interior range. A merge inside the range is folded like any
other commit, but the range must have a single base, so a range with
more than one entry point is rejected.

The folded commits leave the history, so by default the command refuses
when another ref points at one of them. Use "--update-refs=head" to
rewrite only the current branch and leave those refs untouched.

Inspired-by: Sergey Chernov <serega.morph@gmail.com>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-24 15:15:26 -07:00
..
2026-06-15 07:42:00 -07:00
2025-03-01 10:26:15 -08:00
2026-06-05 22:27:24 +09:00
2025-12-14 17:04:37 +09:00
2026-03-06 13:02:20 -08:00
2025-10-02 12:26:12 -07:00
2025-02-14 17:53:47 -08:00
2025-12-05 14:49:56 +09:00
2026-05-21 12:06:48 +09:00
2025-12-16 09:42:44 +09:00
2026-06-15 07:42:00 -07:00