Five tools for splitting an oversized pull request into a stack

Compare ways to split a large pull request into reviewable changes, including agent-proposed plans and manual hunk selection.

If your PR is too big and you’re unsure where to split it, start with Unstoppable Code. It proposes a split you can review before opening the child PRs. Choose Graphite when you already know which hunks belong together and need to keep the original PR open.

Suppose a 900-line checkout PR mixes a new payment interface with a caller migration. It also removes the legacy adapter. Some changes share a file. The first job is deciding what each reviewer should see and in what order.

Decide what each reviewer should see

  1. payment-interface targets main. Introduce the interface and compatibility adapter. Existing callers should still work.
  2. checkout-migration targets payment-interface. Move the callers and update their tests. If the migration has an active discussion you need to keep open, flag that before choosing a split workflow.
  3. remove-legacy-adapter targets checkout-migration. Delete the adapter once every caller has moved. The cleanup diff should make it easy to spot a remaining caller or a deletion that belongs in the migration.

Before changing shared history, record the original head and base, save a local reference to the original tip, and start with a clean working tree. Identify any collaborators or downstream branches relying on the current head. For a split with no other intended code changes, compare the final tip’s tree to the saved tip with git diff <saved-tip> <new-top> and expect an empty diff. Inspect each layer’s diff. Run the tests at each layer. The tree check catches lost or extra changes. The layer checks catch correct changes placed too early.

Unstoppable Code for reviewing a proposed split

Start with an eligible open GitHub PR associated with a desktop Code task and an existing GitHub connection. Enable Split PR in Settings → Git → Pull requests. Check the threshold if the offer is missing. Open the suggested split. Read the preflight. It explains that the workflow creates child PRs and then closes the original. It also warns when starting the split will shut down running terminals, browser tabs, or scripts. At plan review, check that the compatibility adapter lands before the callers move and that deletion comes last. If the migration discussion needs to stay on the original open PR, choose a split that preserves its head branch and check which threads remain attached. Unstoppable Code settings · Split a large pull request

Graphite for choosing boundaries inside a mixed diff

Start with the existing Git branch in a Graphite-initialized repository. Check out the branch and use gt track to select its parent if it’s untracked. Run gt split --by-hunk. Stage the interface and adapter hunks first and name that branch payment-interface. Repeat for the migration and cleanup, giving the migration layer the original head branch name. Use gt log short to check the order. When ready for GitHub review, gt submit --stack creates or updates the PRs and can force-push rewritten branches. For history that already falls into clean, consecutive commit groups, gt split --by-commit preserves the original commits. --by-file moves matching files into a new parent and fits changes separated by path. Keeping the original head name keeps one layer attached to the existing PR. Review which comments still apply after its diff changes. Graphite split guide · Graphite CLI reference · Graphite quick start

Git Town for moving whole commits

This works with separate commits. Run git town prepend --beam payment-interface from checkout-migration to move the interface and adapter commits into a new parent. Return to the migration branch. Run git town append --beam remove-legacy-adapter and select the cleanup commits to move into the child. Check each layer with git town diff-parent. When the branches are ready for review, git town propose on a new layer opens its forge proposal using the configured parent. Confirm the existing migration PR’s base after pushing. Git Town documents that ordinary prepend may push and update an existing proposal, while --beam suppresses branch updates. A mixed commit needs to be separated before this whole-commit workflow can express the intended boundary. Git Town prepend · Git Town append · Git Town stacked changes · Git Town propose

GitButler for arranging commits in a desktop workspace

Start with the existing branch applied in a GitButler workspace. For a mixed tip commit, use but status to identify it, but uncommit <commit-id> to expose the changes, and but diff to find the file or hunk IDs. Create replacement commits from oldest to newest using but commit -b <branch> -m "<message>" <change-ids>. In Desktop, use the Create new branch stack control to add dependent layers and drag commits onto their intended branches. Check the ordering and each branch diff. With the forge already connected, create reviews bottom-up. GitButler sets each upper PR’s base to the closest lower branch with a PR. This fits a team that wants to inspect and rearrange the layers visually. The branch setup and commit moves deserve extra scrutiny if the existing PR and its discussion must stay with the migration. GitButler commit editing guide · GitButler stacked branches and PRs

Sapling for reviewing one commit at a time

Start in a Sapling checkout with the mixed commit at the tip. Run sl split and select the interface hunks first. Put the migration in the second commit and cleanup in the third. Inspect the resulting commits with sl smartlog and check their patches. With gh already authenticated and the existing PR linked to the intended commit, sl pr submit --stack creates or updates one PR per commit. Check the existing association before submission and use sl pr link or sl pr unlink if it needs correcting. Sapling documents that GitHub PRs can show cumulative changes from lower commits. ReviewStack isolates the intended commit, so confirm reviewers can use it if focused diffs are part of the agreement. Sapling split command · Sapling GitHub stack workflow

After the split, confirm the base and diff on each child. Check the required CI jobs, too. Compare the top branch with the saved tip to confirm the split preserved the intended changes.

Cookie preferences

Optional cookies measure ads and feature usage, and improve the site with session recordings. Change anytime. Privacy policy