---
title: Stacks
description: Break large changes into small, reviewable pull requests. One branch, many PRs.
---

AI can write 1,000 lines of code in minutes, but nobody wants to review a
1,000-line pull request. Reviewers skim instead of reading, bugs slip through,
and merges stall for days.

<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap' }}>
  <Button variant="primary" href="/stacks/setup" target="_self">
    Get Started →
  </Button>
  <Button variant="secondary" href="/stacks/agents" target="_self">
    Give your agent this link →
  </Button>
</div>

## The Problem: One Branch = One PR

GitHub's pull request model ties every branch to a single PR. As you add
commits, the PR grows, and so does the review burden.

<GitGraph
  commits={["A", "B", "C", "D", "E"]}
  prs={[{ label: "PR #1", commits: [0, 4], color: "red" }]}
/>

Developers face a bad choice: ship one giant PR that no one can review
thoroughly, or manually manage a chain of dependent branches and rebase each one
whenever the base changes. Git has the tools to split work into atomic commits.
GitHub just doesn't expose them as separate, reviewable units.

## The Solution: One Branch, Many PRs

Mergify Stacks maps each commit on your branch to its own pull request,
automatically chained in dependency order.

<GitGraph
  commits={["A", "B", "C", "D", "E"]}
  commitColor="green"
  prs={[
    { label: "PR #1", commits: 0 },
    { label: "PR #2", commits: 1 },
    { label: "PR #3", commits: 2 },
    { label: "PR #4", commits: 3 },
    { label: "PR #5", commits: 4 },
  ]}
/>

You work on a single local branch using standard Git: commits, rebase, amend.
When you push, Stacks creates a separate PR for each commit, linked together so
reviewers see the logical progression of your work.

- Small, focused PRs that reviewers actually read
- One local branch (no juggling N branches for N PRs)
- Automatic PR chaining with dependency tracking
- Smart updates that only touch PRs that changed
- Standard Git, no new commands to learn
- Ships with skills for Claude Code, Cursor, and any agent supporting [skills.sh](https://skills.sh)
- Complements [Merge Queue](/merge-queue) for safe, fast landing

## Get Started in 30 Seconds

**For your AI coding agent:** share this URL:

```text
https://docs.mergify.com/stacks/agents
```

Your agent installs the CLI and the Stacks skill itself, then you prompt it as usual.

**For yourself:**

```bash
uv tool install mergify-cli
mergify stack setup
mergify stack push
```

See the [setup guide](/stacks/setup) for the full walkthrough.

## Learn More

<DocsetGrid>
  <Docset title="For AI Agents" path="/stacks/agents" icon="fa6-solid:robot">
    A single URL to hand your AI coding agent so it installs the CLI and the
    Stacks skill itself.
  </Docset>
  <Docset title="Concepts" path="/stacks/concepts" icon="fa6-solid:diagram-project">
    How stacks work under the hood: Change-Ids, branch mapping, and PR chaining.
  </Docset>
  <Docset title="Setup" path="/stacks/setup" icon="fa6-solid:wrench">
    Install the CLI and configure your repository in under 2 minutes.
  </Docset>
  <Docset title="Creating Stacks" path="/stacks/creating" icon="fa6-solid:layer-group">
    Walk through creating your first stack from branch to PRs.
  </Docset>
  <Docset title="Updating Stacks" path="/stacks/updating" icon="fa6-solid:pen-to-square">
    Amend, reorder, squash, or add commits and keep PRs in sync.
  </Docset>
  <Docset title="Reviewing Stacks" path="/stacks/reviewing" icon="fa6-solid:magnifying-glass">
    A reviewer's guide to navigating and reviewing stacked PRs.
  </Docset>
  <Docset title="Team Adoption" path="/stacks/team" icon="fa6-solid:people-group">
    Why and how to roll out stacked PRs across your engineering team.
  </Docset>
  <Docset title="Compare Tools" path="/stacks/compare" icon="fa6-solid:scale-balanced">
    Honest comparisons with gh-stack, Graphite, and other stacking tools.
  </Docset>
</DocsetGrid>
