Codework Tech
then
Talk to us↗

Stacked Pull Requests: Split the Big PR Into Layers People Can Review

A 1,800-line PR sitting in the review queue for three days is a problem every team knows. GitHub now has stacked pull requests built in. Here is what they fix and what they don't.

Nattapong Netnu

5 min read

A single 1,800-line pull request waiting three days for review next to a stack of four small pull requests (migration, queries, handler, UI), each approved and merged into main in one operation

Key takeaways

  • Stacked pull requests are ordered PRs in one repo, each with its own diff, reviewed layer by layer and merged in one atomic operation. GitHub has had them built in since 30 July 2026, still in public preview.
  • The reason they're getting attention is volume: 1.3 billion merged PRs this year, and over 40% of pull requests now start from an agent's draft.
  • Check the limits first: no cross-fork stacks, no GitHub Desktop, every rule evaluated against the trunk, and CI running on every layer.
  • No solid research shows small PRs merge faster. The real wins are reviewers who understand the diff and authors who aren't blocked waiting.
  • Small teams should start with one long change, cut along system boundaries, stay under five layers, and merge bottom-up.

You open a PR: 1,800 lines, 40 files touched, everything from a migration to the UI. A reviewer clicks in, scrolls, and goes back to their own work. Three days later there are still no comments, and you can't move either, because the next piece of work sits on top of that code. This is exactly the situation stacked pull requests are for.

The idea is to cut one big change into small PRs that sit on top of each other, so each one gets reviewed on its own. Large teams have been doing this for years with external tooling, but since 30 July 2026 GitHub has it built in, in public preview (GitHub Changelog). By September more than 264,000 developers had tried it (Octoverse 2026).

What stacked pull requests actually are

A stack is several PRs in the same repository, ordered. Each PR targets the branch of the PR below it, down to the bottom one, which targets the trunk, usually main.

Say you're adding one new endpoint. A stack might look like this:

  1. Layer 1: migration and model
  2. Layer 2: queries and the repository layer
  3. Layer 3: handler, validation, tests
  4. Layer 4: the UI

Open any PR in the stack and you see only that layer's diff, not the whole pile. A stack map at the top shows where the layer fits into the full change. When you merge, you don't click through PRs one by one: merging the highest ready PR lands it and every unmerged layer below it as a single atomic operation (GitHub Docs).

The part that matters more in practice: if you merge only the lower layers, GitHub rebases and retargets the ones still open. No manual retargeting. That chore is the main reason people used to abandon a stack halfway through.

Why this is getting attention now

Because the number of PRs per day isn't what it was two years ago. GitHub counted 1.3 billion merged pull requests this year, up from 538 million the year before, and by September 2026 more than 40% of all pull requests started from an agent's first draft, against 17% in March (Octoverse 2026).

The number reviewers should care about is a different one: PRs with detected agent involvement touch multiple files more often, about 87% versus 79% for the rest. More changes spread over more files are arriving in the review queue, and the number of people reviewing them hasn't changed.

If that's your team's bottleneck, we wrote about review queues and CI gates in handling AI-generated code in a real team. This post is about the step before that: how the work is cut up before it reaches the queue.

Getting started

You don't need the CLI. Open the bottom PR against main as usual, then create the next PR with its base set to the first PR's branch, and GitHub treats it as a stack. If you do this often, the extension saves real time:

bash
gh extension install github/gh-stack
gh stack init                 # start a stack (--base for a non-default trunk)
gh stack push                 # push every branch, create and link the PRs
gh stack rebase               # when the trunk moves, or a lower layer changes

If your team already uses Jujutsu or Sapling, push branches with those and open the stack on GitHub afterwards.

Limits to check before you move the team

This is the part the changelog doesn't say loudly, but the docs do.

  • All branches must live in the same repository. Cross-fork stacks aren't supported, so a fork-based open-source workflow is out.
  • GitHub Desktop isn't supported. If someone on the team works only through Desktop, agree on that first.
  • Rules are evaluated against the trunk, not the PR's direct base. Required reviews, status checks, CODEOWNERS, code scanning: all measured against main, and a PR can only merge once every layer beneath it passes too.
  • Bypass rules only work on the bottom PR. You can't force a whole stack through.
  • Linear history is required. If it breaks, run gh stack rebase and push, or click Rebase stack in the merge box.
  • Merge queue support came later. At preview time GitHub said merge queue support would roll out progressively over the following weeks, so check its state if your team lives in the queue.
  • CI runs on every layer. Workflows trigger for every PR in the stack with no config changes. Good for confidence, but your runner bill multiplies by the number of layers. GitHub ran 45.4 billion Actions jobs this year; on a couple of small self-hosted runners, your queue will get longer.

Do smaller PRs really get reviewed faster?

Honestly, there isn't strong evidence that PR size drives merge time. A 2022 study of 845,316 pull requests across 100 popular projects found that the size and composition of a pull request do not relate to time-to-merge, and pointed out that industry guidance on the ideal change size lacks evidence behind it (arXiv).

Tool vendors see it differently. Graphite looked at roughly 1.5 million PRs from its own customers and reports that even a small increase in files changed can more than double time-to-merge (Graphite), while admitting the data skews toward small PRs, because its customers are the people already splitting them.

So don't sell stacks to your team as "merges twice as fast". The two benefits you can actually count on are different. First, a reviewer reads a focused 150-line diff and genuinely understands it, instead of approving because they gave up. Second, and bigger: you don't wait for the first PR to be approved before starting the next piece. Work continues on the layer above.

Should a small team use them?

My own take: a team of three or four shouldn't switch everyone at once. Start with one person and one change you already know will take more than a day, like moving auth or adding a module that also touches the schema.

The rules that hold up in practice are few:

  1. Cut along system boundaries, not along when you happened to commit (schema, then data access, then business logic, then UI).
  2. Keep a stack to four or five layers. Beyond that reviewers lose the thread.
  3. Review bottom-up only, and finish merging the lower layers first.
  4. The bottom layer must be mergeable without breaking anything. If it isn't, you cut in the wrong place.
  5. If a lower layer gets sent back for a rethink, close the layers above and rebuild. Cheaper than pushing on.

Teams not on GitHub, or working through forks, still have Graphite, git-town, or Jujutsu locally. And if PRs aren't piling up in your queue today, you don't need any of this. Stacks are for teams whose review queue has genuinely stopped moving.

If your team is stuck behind a review queue or a slow pipeline, talk to Codework. We can look at your review flow and CI pipeline and get delivery moving again.

Talk to our team

Frequently asked questions

How is this different from merging sub-PRs into a feature branch?

The difference is at the end. With a feature branch you merge sub-PRs into an intermediate branch and then open one more PR into main, so a reviewer faces the combined diff again. In a stack every layer is evaluated against the trunk's rules from the start, and the whole stack lands on main in a single operation, with no combined diff to re-review.

If a lower layer changes during review, do I have to rebase the layers above?

Usually not. GitHub cascades the rebase when a lower layer merges or when history breaks. If the stack doesn't come back to a linear state on its own, run gh stack rebase then gh stack push, or click Rebase stack in the merge box. If the rebase doesn't change the diff, existing approvals are kept.

Does CI run again on every layer?

Yes, workflows trigger for every PR in the stack with no config change. Every layer gets genuinely tested before it reaches main, but runner cost or self-hosted queue time multiplies by the number of layers. If your pipeline is heavy, use fewer layers or move the slowest jobs so they only run on the top PR.

Is it worth it for a team of three?

It's worth it if PRs sit in the queue or if authors have to wait for review before continuing. If your team reviews within a day and PRs are already small, don't rush. A new process has its own cost.

Sources

  1. [1]Stacked pull requests are now in public preview — GitHub Changelog, 31 Jul 2026
  2. [2]Stacked pull requests — GitHub Docs
  3. [3]Octoverse: Commits, pushes, reach new highs in 2026 as developers build with agents — The GitHub Blog, 28 Oct 2026
  4. [4]Do Small Code Changes Merge Faster? A Multi-Language Empirical Investigation — arXiv
  5. [5]The ideal PR is 50 lines long — Graphite
  • AI Coding Tools
  • CI/CD
  • Clean Code
  • Code Review

Written by

Nattapong Netnu

Senior Backend Developer

I design and run the back end, from APIs and databases to background jobs, so the data is accurate, the system stays stable and it’s ready to grow.

Let's build together

Have an idea worth building?

Tell us about it, and we'll work out the best way to bring it to life.