Why Your PRs Are a Bottleneck
Mega-PRs cripple development velocity. Reviewing hundreds, often thousands, of lines of code becomes an impossible task, leading to overlooked bugs, superficial reviews, and severe review fatigue. These monolithic changes block other developers from integrating their work, creating widespread bottlenecks.
Consequence: escalating merge conflicts, rapidly stale code branches, and dramatically delayed releases. This inefficient cycle wastes countless engineering hours, introduces significant risk into the codebase, and frustrates development teams with its inherent complexity.
GitHub now delivers Stacked PRs, an official, platform-native answer to this persistent problem. This robust feature moves beyond ad-hoc community workarounds, integrating powerful dependency management directly into your workflow.
The core concept is simple: break large code changes into a chain of smaller, dependent pull requests. Each PR builds directly on the previous one, enabling independent review, approval, and merging without blocking the entire feature.
Illustrate this dependency chain: Your initial, foundational PR targets main—for instance, a critical database schema migration. Then, a second PR targets that first PR, implementing new API routes dependent on the updated schema. Finally, a third PR targets the second PR, adding UI components consuming the new API. This creates a clear, logical, and manageable progression for complex features.
Your New Workflow: Stack, Add, Submit
Implement stacked PRs using the GitHub CLI for a streamlined, efficient workflow. Initiate your new stack with gh stack init [branch-name]. This command establishes your foundational branch, automatically basing it on your repository’s default branch, typically main. This ensures your lowest-level changes are ready first.
Progress your development incrementally by adding further changes. Employ gh stack add [branch-name] to create a new branch that automatically bases itself on the previous branch in your stack. This establishes a clear dependency chain, ensuring each subsequent change builds logically on the one before it, from foundational types to API routes.
Crucially, standard Git operations persist beneath this CLI convenience. Each gh stack add command ultimately creates a new Git branch, and you retain the flexibility to include multiple commits within any single branch in your stack. This provides structured development without sacrificing granular control over commit history.
When all changes are complete across your stack, consolidate your efforts with a single command: gh stack submit. This pushes every branch in your stack to GitHub simultaneously, generating individual pull requests for each. GitHub then renders these as a cohesive stacked PR in the UI, simplifying review.
While the GitHub CLI offers powerful automation and convenience, it is not a strict prerequisite. Developers can still manually construct stacks by ensuring each pull request explicitly targets the correct preceding base branch. GitHub intelligently detects and visualizes these dependencies, even without CLI orchestration, providing the same UI benefits and review experience.
Beyond the CLI: Stacks in the Wild
GitHub elevates stacked PRs with first-class UI support. Notice the distinct stack icon now present on the pull request list page, instantly signaling that a PR is part of a larger dependency chain. This visual indicator streamlines the identification and management of interconnected work, improving overall project visibility.
Dive into any PR within a stack to leverage the dedicated stack view. This powerful interface visualizes the entire dependency chain, clearly mapping each PR's position, its target branch, and its current review status. You gain immediate clarity on complex feature sets, understanding dependencies and progress at a glance. For more foundational details on working with pull requests and their new stacked capabilities, refer to About stacked pull requests - GitHub Docs.
The true efficiency arrives with the Merge stack button. After all individual PRs in a stack achieve approval, a single click merges the entire approved chain into the main branch. GitHub automatically executes the sequential merging, handling all intermediate steps like rebasing and branch updates. This atomic operation guarantees a clean, integrated merge without manual intervention, accelerating your delivery pipeline and minimizing merge conflicts.
Enjoying this? Get one like it in your inbox each morning.
one email a day · unsubscribe in two clicks · no third-party tracking
Stacks Aren't Just for Humans
Smaller, focused diffs immediately unblock reviewers, dramatically accelerating review cycles. Reduced context switching and cognitive load mean faster approvals and higher quality feedback. Teams now iterate faster, deploying features with unprecedented efficiency.
Beyond human workflows, Stacked PRs unlock a powerful future for AI. AI agents can now submit complex, multi-part features as structured, dependent pull requests. This breaks down monolithic AI-generated code into manageable, reviewable chunks. Instead of a single, massive code dump, agents output a human-reviewable dependency chain, providing a clear, auditable path for integrating sophisticated AI contributions.
This feature is more than a workflow optimization; it represents a foundational shift in collaborative development practices. It fundamentally redefines how teams approach complex feature delivery and concurrent work. Developer response has been overwhelmingly positive, validating GitHub's vision for evolving core development. Expect immediate, significant boosts in team velocity and overall project throughput.
Frequently Asked Questions
What are GitHub Stacked PRs?
A native GitHub feature for creating a chain of smaller, dependent pull requests that can be reviewed independently and merged together as a single unit.
Do I need the GitHub CLI to use Stacked PRs?
No. The CLI (with gh stack commands) streamlines the process, but you can create a stack manually by targeting subsequent PRs at the previous PR's branch. GitHub automatically detects the stack.
How is a stack different from just chaining PRs?
While the Git concept is similar, GitHub now officially recognizes these chains as a 'stack.' This provides a dedicated UI for managing, visualizing, and merging the entire stack at once, which was previously a manual process.
Can I work on other branches while I have an active stack?
Yes. A stack is a management layer on top of Git. You can use standard Git commands like git checkout to switch to unrelated branches and then return to a branch within your stack later without issue.

