Skip to main content

Rebasing and Stacked Branch Answers

Fixes for rebasing stacked branches, squash merges and keeping dependent branches current.

A stack is a chain of branches where each one builds on the one below. Rebasing a stack by hand is where most of the pain is. Each answer below covers one situation.

With Git 2.38 or newer, rebasing a whole stack with --update-refs moves every branch in one command. If the bottom branch was squash merged, rebase the next branch with --onto instead. The Stacked PR Workflow shows the review cycle around these fixes.