English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

GitHub Stacked PRs: Breaking 1000+ Line AI Diffs into Independently Reviewable Chains

Forum topic · 小凯 · 2026-08-05

Summary

GitHub launched Stacked Pull Requests in public preview on July 31, with an August 4 engineering blog detailing a complete workflow for making massive AI-generated diffs reviewable. A stacked PR is a chain of ordered, linked PRs in the same repository, where each PR branches off the one below it and merges bottom-up; upper layers automatically rebase as lower ones merge. GitHub.com offers native UI with a stack map, the CLI manages lifecycle via the gh-stack extension (GitHub CLI 2.90.0+, Git 2.20+), and AI agents like Copilot can call gh stack commands through a gh-stack skill to split changes automatically. Branch protection and required checks apply across the entire chain—stacking bypasses no merge gates. The blog demonstrates splitting a 1000+ line AI diff into four layers (data model, API, wiring, UI), each with its own reviewer. The core argument: AI has collapsed the cost of writing code, so the bottleneck has shifted to review, and stacked PRs make small, incremental review a platform default. Practical caveats include rebase conflicts, per-layer testing, and prompt-dependent auto-splitting quality.

GitHub shipped Stacked Pull Requests in public preview on July 31, and followed up on August 4 with an engineering blog describing a complete workflow for turning giant AI-generated diffs into something reviewable. This is not just a new feature—it is GitHub's first explicit admission that when an agent generates 1000+ lines of code in one shot, the traditional "one PR, one conversation" model breaks down.

How it works

Technically, stacked PRs are an ordered chain of linked PRs within the same repository. Each PR targets the branch of the PR below it, forming a bottom-up merge chain: the base merges first, and upper layers automatically rebase to follow.

  • GitHub.com: native UI plus a stack map showing dependencies
  • CLI: lifecycle management via the gh-stack extension (GitHub CLI 2.90.0+, Git 2.20+)
  • AI agents: a gh-stack skill lets Copilot and other agents call gh stack commands to split changes automatically
  • Importantly, branch protection and required checks apply across the entire chain—stacking bypasses no merge gates. GitHub has deliberately bundled "safety governance" with the workflow upgrade.

    The example workflow

    The blog's case study splits a 1000+ line AI-generated diff into four layers:

    1. L1 — data model 2. L2 — API 3. L3 — wiring layer 4. L4 — UI

    Each layer gets a different reviewer; the base layer is reviewed and merged first, and upper layers build on it. This matches WHOOP engineer Mayank Saini's experience: "A big change used to mean one giant PR nobody wanted to review. Now it's a stack of small PRs where reviewers can actually follow the reasoning—and the whole chain merges at once."

    Why now?

    AI coding has collapsed the cost of *generating* code, but the cost of *reviewing* it hasn't changed. An engineer reviewing a 1000-line PR isn't much faster than reviewing 200 lines, yet an agent produces 1000 lines in minutes. The bottleneck has shifted from writing to reading, throttling the entire pipeline at the review stage.

    Stacked PRs are not "prefer small PRs" discipline rhetoric—they make incremental review a platform default. The agent decides how many layers, how big each layer is, and who reviews; the stack map keeps dependencies visible while reviewers browse layers in parallel.

    Four real-world caveats

  • Splitting isn't free—upper layers must rebase and resolve conflicts after lower-layer changes, and CI can't be skipped.
  • Tests must run at every layer, not just after the whole chain is done.
  • Upper layers aren't independently shippable until they land on main.
  • The gh-stack skill's auto-splitting depends on prompt quality—it's not magic, and reviewers still need to examine each layer's actual changes.
  • Takeaway

    Stacked PRs belong to the same wave as OpenAI Codex's Sol/Luna layering and Cloudflare's ADLC: when AI compresses implementation toward zero, every stage of engineering management gets rewritten. GitHub chose stacking because it stays within the "PR as the unit of collaboration" tradition—the path of least resistance and best ecosystem compatibility. Teams already using Graphite, Sapling, or git-branchless may find native stacking isn't a full replacement yet, but GitHub's entry turns stacking from an "advanced technique" into a "default action"—and by GA, native stacking could well become the default workflow for new repositories.

    Links:

  • Original post: https://github.blog/engineering/turn-one-giant-ai-generated-pull-request-to-a-reviewable-stack
  • Docs: https://docs.github.com/pull-requests/get-started/stacked-prs-quickstart

Tags

#github#stacked-prs#ai-generated-code#code-review#developer-workflow#copilot#engineering-management

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178594089