Skip to content

rebase: add --fixup to fold a range into its oldest commit#2323

Open
HaraldNordgren wants to merge 1 commit into
git:masterfrom
HaraldNordgren:hn/rebase-fixup-fold
Open

rebase: add --fixup to fold a range into its oldest commit#2323
HaraldNordgren wants to merge 1 commit into
git:masterfrom
HaraldNordgren:hn/rebase-fixup-fold

Conversation

@HaraldNordgren
Copy link
Copy Markdown
Contributor

No description provided.

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 rebase --autosquash --fixup [<upstream>]" to do this directly.
It keeps the oldest commit in the range as a "pick" and turns every
later commit into a "fixup", so the whole range collapses into a single
commit that reuses the oldest commit's message. With no <upstream>
argument the range is "@{upstream}..HEAD", folding all unpushed commits
into one.

Fold the commits in their original order, so that any fixup!/squash!
commits already present in the range are folded in as well. Allow the
flag only together with --autosquash.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
@HaraldNordgren HaraldNordgren force-pushed the hn/rebase-fixup-fold branch from fec8b65 to 0859468 Compare June 6, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant