> For the complete documentation index, see [llms.txt](https://argos-ci.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://argos-ci.com/docs/learn/review-workflow/stacked-pull-requests.md).

# Stacked pull requests

Argos supports stacked pull requests natively: each one is compared with the pull request below it, and you can move through the stack from the build page.

Argos supports stacked pull requests natively. When you open a pull request on top of another one, Argos compares its screenshots with the pull request below it instead of your baseline branch. Each build shows only the changes its own pull request makes, and the build page lets you move from one pull request of the stack to the next.

There is nothing to configure. Stack your pull requests by hand or with a tool like Graphite: what matters is that each pull request targets the branch of the one below it.

{% hint style="info" %}
Stacked pull requests are detected on GitHub. Comparing with the pull request below relies on [baseline selection from commit history](https://argos-ci.com/docs/learn/platform-fundamentals/baseline-build.md), which needs the [Argos GitHub App with full access](https://argos-ci.com/docs/learn/integrations/github-integration.md#choose-your-access-level).
{% endhint %}

### How Argos detects a stack

A pull request is **stacked** when both are true:

* Its base branch is the head branch of another open pull request in the same repository.
* Its base branch is not an [auto-approved branch](https://argos-ci.com/docs/learn/platform-fundamentals/baseline-build.md#auto-approved-branches).

A pull request opened from a fork never counts as the one below: a fork's branch can share its name with one of your repository's branches.

### What a stacked pull request is compared with

Take two pull requests:

1. **#101 Add the order summary**, from `feat/summary` into `main`.
2. **#102 Refactor the order summary card**, from `feat/summary-card` into `feat/summary`.

\#102 is stacked on #101. Its [baseline branch](https://argos-ci.com/docs/learn/platform-fundamentals/baseline-build.md#the-baseline-branch) is `feat/summary`, so Argos compares it with the build of #101 on the commit `feat/summary-card` starts from. If the refactor changes nothing visible, the build of #102 reports no changes. Compared with `main`, it would show every change of #101 again.

A build is usually a baseline only once it's [approved](https://argos-ci.com/docs/learn/platform-fundamentals/baseline-build.md#when-the-baseline-must-be-approved). For a stacked pull request, Argos uses the build of the pull request below even before anyone approves it: that pull request is still in review, and its build is the state yours starts from. A rejected build is never used.

Rebase your pull request on the one below to compare with its latest changes. Once the pull request below is merged and yours targets your baseline branch again, its next build compares with that branch as usual.

### Move through the stack

On the build page of a stacked pull request, a **stacked** button appears next to the pull request in the header, with the number of pull requests in the stack. It opens the stack, from its top down to the branch it merges into:

* Each pull request shows the status of its latest build with the same [build name](https://argos-ci.com/docs/learn/how-to-guides/ci-pipelines/monorepos-setup.md), and opens that build.
* The pull request of the build you're looking at is highlighted.
* A pull request that has no build yet reads **No build**.

![The stack menu opened from the build header, with the pull request being reviewed highlighted](https://2221810533-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0slCNmeVzY3qdh0I85HX%2Fuploads%2Fgit-blob-b964d9b88386eda3f268eb588ad9b63c241a5113%2Fstacked-pull-requests-menu.png?alt=media)

When two open pull requests target the same branch, the stack forks, and the menu stops below them. Each of them is still compared with the pull request it targets.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://argos-ci.com/docs/learn/review-workflow/stacked-pull-requests.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
