GitHub's Stacked PRs Tackle AI Code Bloat

GitHub's stacked pull requests help developers manage large AI-generated code changes by breaking them into reviewable layers.

Diagram showing stacked pull request layers from base to top
Github Blog
Visual TL;DR
AI Code BloatDriver
AI agents generate massive, monolithic pull requests, often over a thousand lines
From the article 9+ mentionsBut as AI agents churn out code at an unprecedented rate, they often present developers with a familiar, yet amplified, problem: the giant, un-reviewable pull request.
Unreviewable PRsDriver
developers face difficulty reviewing giant code changes with mixed concerns
From the article 3 mentionsThis layered approach means that a data owner can review the data model, while a UI specialist can focus on the frontend components, all within manageable, scoped PRs.
GitHub Stacked PRsCore
feature breaks large AI-generated code into smaller, reviewable layers
From the article 2 mentionsBy installing the `gh-stack` CLI extension and teaching agents how to manage stacked PRs, development teams can direct their AI coding partners to produce work in this more reviewable format.
Decomposition CoreContext
stacked PRs enable breaking down complex features into manageable, logical steps
From the articleThe solution proposed by GitHub is rooted in a long-standing software engineering principle: decomposition.
Teach AI to StackEffect
training AI agents to produce stacked PRs as their default output
From the article 2 mentionsGitHub’s implementation allows this to be managed directly through the pull request UI and via the `gh stack` command-line interface.
Streamlined ReviewsEffect
smaller, focused changes are easier for human developers to review effectively
From the article 4 mentionsThe result is a review process that grinds to a halt, with reviewers overwhelmed by the sheer volume, leading to delayed merges and potentially lower quality code.
Faster AI DevOutcome
managing AI-driven code sprawl leads to quicker development cycles
From the articleThe promise of AI coding assistants is undeniable: faster development cycles, increased productivity, and a significant boost to the software development lifecycle.
Increased ProductivityOutcome
AI could drive a 50% productivity gain across every SDLC stage
From the article 2 mentionsThe promise of AI coding assistants is undeniable: faster development cycles, increased productivity, and a significant boost to the software development lifecycle.
Contents(3)

The promise of AI coding assistants is undeniable: faster development cycles, increased productivity, and a significant boost to the software development lifecycle. Gartner projects AI could drive a 50% productivity gain across every SDLC stage by 2028. But as AI agents churn out code at an unprecedented rate, they often present developers with a familiar, yet amplified, problem: the giant, un-reviewable pull request. GitHub is now offering a way to tame this AI-driven code sprawl with its stacked pull requests feature.

Imagine prompting an AI to add a complex feature, like product search to an e-commerce application. Minutes later, you’re faced with a single pull request potentially spanning over a thousand lines of code. This single commit might bundle a new data model, API routes, client wiring, UI elements, and error states, all mashed together. For AI models trained on traditional coding patterns, this monolithic approach is often the default output. The result is a review process that grinds to a halt, with reviewers overwhelmed by the sheer volume, leading to delayed merges and potentially lower quality code.

Decomposition: The Core of Stacked PRs

The solution proposed by GitHub is rooted in a long-standing software engineering principle: decomposition. Stacked pull requests allow developers, and critically, their AI coding partners, to break down a large feature into a series of smaller, logically ordered, and independently reviewable pull requests. Each layer builds upon the previous one, creating a dependency chain that mirrors how complex features are typically built.

Consider adding product search. Instead of one massive PR, the work can be segmented:

  • Layer 1 (Base): A typed catalog data model with validation and a data access module.
  • Layer 2: A validated API endpoint to retrieve product data, depending on Layer 1.
  • Layer 3: Integration logic for the chat assistant to call the API and use real product data, depending on Layer 2.
  • Layer 4 (Top): UI components for displaying product citations and managing state, depending on Layer 3.

This layered approach means that a data owner can review the data model, while a UI specialist can focus on the frontend components, all within manageable, scoped PRs. GitHub’s implementation allows this to be managed directly through the pull request UI and via the `gh stack` command-line interface.

Teaching AI Agents to Stack

The real innovation here is extending this workflow to AI agents. By installing the `gh-stack` CLI extension and teaching agents how to manage stacked PRs, development teams can direct their AI coding partners to produce work in this more reviewable format. Custom agents can be assigned specific layers of the stack, a data modeler agent for Layer 1, backend agents for Layer 2, and frontend agents for subsequent layers. This ensures that AI-generated code adheres to a structured, incremental delivery process, rather than a single, overwhelming commit.

Why This Matters for the AI Development Workflow

The ability to manage AI-generated code effectively is becoming paramount. As tools like GitHub Copilot become more sophisticated, their output needs to be integrated into existing, high-quality development workflows. Stacked pull requests address a critical bottleneck: code review. By breaking down complex AI-generated features into bite-sized, focused PRs, teams can maintain context, improve feedback quality, and accelerate merge cycles. This is particularly important for smaller startups or teams with limited review bandwidth, where a single large PR can become a significant blocker.

For founders and investors, this signals a maturing of the AI development toolchain. It’s no longer just about generating code, but about integrating that generation into established, efficient software engineering practices. Companies that can effectively manage AI-assisted development, from prompt to deploy, will gain a significant competitive edge.

The underlying technology, including GitHub’s own engineering infrastructure, is designed for performance and availability. This focus on developer experience, even when dealing with the complexities introduced by AI, is key to GitHub’s position as a leader in AI code assistants, as recognized by Gartner. The challenge now is for AI agents to consistently produce work that fits this structured approach, moving beyond monolithic code dumps to a more modular, reviewable output.

© 2026 StartupHub.ai. All rights reserved. You may not republish this article in full without a license. Search engines and AI research tools may crawl and summarize for reference. Bulk reproduction or model training requires a license. See our terms.
Daniel Singer

Written by

Daniel Singer

Editor, StartupHub.ai

Daniel Singer is the editor of StartupHub.ai, a technology expert and thought leader on AI and its applications across sectors, from fintech and healthcare to developer tooling and consumer software. He writes and tests the tools covered here thoroughly and regularly, and built StartupHub.ai to give founders, operators and buyers a clearer read on what they are actually being sold.