You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### What is a stacked PR? How is it different from a regular PR?
8
+
### What is a Stacked PR? How is it different from a regular PR?
9
9
10
-
A stacked PR is a pull request that is part of an ordered chain of PRs, where each PR targets the branch of the PR below it instead of targeting `main` directly. Each PR in the stack represents one focused layer of a larger change. Individually, each PR is still a regular pull request — it just has a different base branch and GitHub understands the relationship between the PRs in the stack.
10
+
A Stacked PR is a pull request that is part of an ordered chain of PRs, where each PR targets the branch of the PR below it instead of targeting `main` directly. Each PR in the stack represents one focused layer of a larger change. Individually, each PR is still a regular pull request — it just has a different base branch, and GitHub understands the relationship between the PRs in the stack.
11
11
12
-
### How do I create a stacked PR?
12
+
### How do I create a Stacked PR?
13
13
14
14
You can create a stack using the `gh stack` CLI:
15
15
@@ -27,13 +27,13 @@ You can also create stacks entirely from the GitHub UI — create the first PR n
27
27
28
28
### How do I add PRs to my stack?
29
29
30
-
Use `gh stack add <branch-name>` to add a new branch on top of the current stack. When you run `gh stack submit`, a PR is created for each branch and they are linked together as a Stack on GitHub.
30
+
Use `gh stack add <branch-name>` to add a new branch on top of the current stack. When you run `gh stack submit`, a PR is created for each branch, and they are linked together as a Stack on GitHub.
31
31
32
32
You can also add PRs to an existing stack from the GitHub UI. See [Adding to an Existing Stack](/gh-stack/guides/ui/#adding-to-an-existing-stack) for details.
33
33
34
34
### How can I modify my stack?
35
35
36
-
Reordering or inserting branches into the middle of a stack is not currently supported. To restructure a stack, use `gh stack unstack` to tear it down and then recreate it with `gh stack init --adopt`:
36
+
Reordering or inserting branches into the middle of a stack is not currently supported. To restructure a stack, use `gh stack unstack` to tear it down and then re-create it with `gh stack init --adopt`:
No, stacked PRs currently require all branches to be in the same repository. Cross-fork stacks are not supported.
57
+
No, Stacked PRs currently require all branches to be in the same repository. Cross-fork stacks are not supported.
58
58
59
59
## Checks, Rules & Requirements
60
60
61
-
### How are branch protection rules evaluated for stacked PRs?
61
+
### How are branch protection rules evaluated for Stacked PRs?
62
62
63
63
Every PR in a stack is treated as if it is targeting the **base of the stack** (typically `main`), regardless of which branch it directly targets. This means:
64
64
65
65
-**Required reviews** are evaluated as if the PR is targeting the stack base.
66
66
-**Required status checks** are evaluated as if the PR is targeting the stack base.
67
-
-**CODEOWNERS** are evaluated from the stack base — changes in codeowners on a PR at the bottom of the stack will not affect PRs above it in the stack.
67
+
-**CODEOWNERS** are evaluated from the stack base — changes in `CODEOWNERS` on a PR at the bottom of the stack will not affect PRs above it in the stack.
68
68
-**Code scanning workflows** are evaluated as if the PR is targeting the stack base.
69
69
70
-
### How do GitHub Actions work with stacked PRs?
70
+
### How do GitHub Actions work with Stacked PRs?
71
71
72
72
GitHub Actions workflows trigger as if each PR in the stack is targeting the base of the stack (e.g., `main`). If you have a workflow configured to run on `pull_request` events targeting `main`, it will run for **every PR in the stack** — not just the bottom one.
73
73
74
74
### Do all previous PRs need to be passing checks before I can merge?
75
75
76
-
Yes. In order to merge a PR in the stack, **all PRs below it** must also have passing checks and meet all merge requirements. For example, in a stack of `main <- PR1 <- PR2 <- PR3` and you want to merge PR #3, both PR #1 and PR #2 must have passing checks, required reviews, and satisfy all branch protection rules.
76
+
Yes. In order to merge a PR in the stack, **all PRs below it** must also have passing checks and meet all merge requirements. For example, in a stack of `main <- PR1 <- PR2 <- PR3`, if you want to merge PR #3, both PR #1 and PR #2 must have passing checks, required reviews, and satisfy all branch protection rules.
77
77
78
78
### Is a linear history required?
79
79
@@ -86,13 +86,13 @@ If the stack is not linear (e.g., after changes were pushed to a lower branch),
86
86
87
87
## Merging Stacked PRs
88
88
89
-
### What conditions need to be met for a stacked PR to be mergeable?
89
+
### What conditions need to be met for a Stacked PR to be mergeable?
90
90
91
91
Every PR in a stack must meet the same merge requirements as a PR targeting the stack base (e.g., `main`): required reviews, passing CI checks, CODEOWNER approvals, and a linear history. All PRs below it must also meet these requirements. See the [Checks, Rules & Requirements](#checks-rules--requirements) section above for details.
92
92
93
93
### How does merging a stack of PRs differ from merging a regular PR?
94
94
95
-
Stacks must be merged **from the bottom up**. You can merge the bottom PR (and all non-merged PRs below it) in a single operation. After a PR is merged, the remaining stack is automatically rebased so the next PR targets `main` directly.
95
+
Stacks must be merged **from the bottom up**. When you merge a PR, all non-merged PRs below it in the stack are also merged. After a PR is merged, the remaining stack is automatically rebased so the next PR targets `main` directly.
96
96
97
97
### What happens when you merge a PR in the middle of the stack?
98
98
@@ -114,23 +114,23 @@ With rebase merge, all of the commits from each PR in the stack are replayed ont
114
114
115
115
PRs in a stack are merged sequentially, from the bottom up. When you initiate a merge, the bottom PR is merged first, and then the next PR above it, and so on.
116
116
117
-
There will not be a single push operation that adds all the commits from all the branches at once.
117
+
Commits are not all landed in a single atomic operation — each PR is merged individually in sequence.
118
118
119
119
### Can I merge only part of a stack? What happens to the remaining unmerged PRs?
120
120
121
-
Yes, partial stack merges are supported. After the merge, the lowest unmerged PR is updated to explicitly target the stack base (e.g. `main`). A cascading rebase is also automatically run to rebase the remaining unmerged branches.
121
+
Yes, partial stack merges are supported. After the merge, the lowest unmerged PR is updated to explicitly target the stack base (e.g.,`main`). A cascading rebase is also automatically run to rebase the remaining unmerged branches.
122
122
123
123
### What happens if you close a PR in the middle of the stack?
124
124
125
-
Closing a PR in the middle of the stack will block all PRs above it from being mergeable. The stack relationship is preserved, so if you want to open a different PR or modify the stack, you will need to unstack and then recreate the stack.
125
+
Closing a PR in the middle of the stack will block all PRs above it from being mergeable. The stack relationship is preserved, so if you want to open a different PR or modify the stack, you will need to unstack and then re-create the stack.
126
126
127
127
### What happens when there is an error merging a PR in the middle of a stack?
128
128
129
129
If a merge fails (e.g., due to a failing check or merge conflict), the operation stops and no subsequent PRs are merged. You'll need to resolve the issue before continuing.
130
130
131
-
### Does Stacked PRs support merge queue?
131
+
### Do Stacked PRs support merge queue?
132
132
133
-
Yes, stacked PRs fully support merging via merge queue. When you merge a stack through the merge queue:
133
+
Yes, Stacked PRs fully support merging via merge queue. When you merge a stack through the merge queue:
134
134
135
135
-**All PRs in the stack are added to the queue** in the correct order, ensuring a linear sequence.
136
136
-**If a PR is removed or ejected from the merge queue**, all PRs above it in the stack are also ejected and removed from the queue.
@@ -154,7 +154,7 @@ No. Stacked PRs are built on standard git branches and regular pull requests. Yo
154
154
155
155
### Will this work with a different tool for stacking?
156
156
157
-
Yes, you can continue to use your tool of choice (e.g. jj, Sapling, ghstack, git-town, etc.) to manage stacks locally and push up your branches to GitHub.
157
+
Yes, you can continue to use your tool of choice (e.g., jj, Sapling, ghstack, git-town, etc.) to manage stacks locally and push up your branches to GitHub.
158
158
159
159
Stacked PRs on GitHub are based on the standard pull request model — any tool that creates PRs with the correct base branches can work with them. The `gh stack` CLI is purpose-built for the GitHub experience, but other tools that manage branch chains should be compatible.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/stacked-prs.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Practical guide for reviewing, merging, and managing stacked pull r
5
5
6
6
This guide covers the practical day-to-day experience of working with Stacked PRs — how to review them, how merging works step by step, and how to keep things in sync from the CLI.
7
7
8
-
For an introduction to what stacks are and how GitHub supports them natively, see the [Overview](/gh-stack/introduction/overview/). For a visual walkthrough of the UI, see [Using Stacks in the GitHub UI](/gh-stack/guides/ui/).
8
+
For an introduction to what stacks are and how GitHub supports them natively, see the [Overview](/gh-stack/introduction/overview/). For a visual walkthrough of the UI, see [Stacked PRs in the GitHub UI](/gh-stack/guides/ui/).
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/ui.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Stacked PRs in the GitHub UI
3
-
description: A visual walkthrough of creating, navigating, merging, and managing stacked PRs directly in the GitHub pull request UI.
3
+
description: A visual walkthrough of creating, navigating, merging, and managing Stacked PRs directly in the GitHub pull request UI.
4
4
---
5
5
6
6
This guide walks through the key UI components and workflows for working with Stacked PRs on GitHub.
@@ -51,7 +51,7 @@ If a stack already exists and you want to add a new PR to it:
51
51
52
52

53
53
54
-
2. On the following page, the base branch is automatically set to the head of the top-most PR. Select the head branch for your new PR and click **Create pull request**.
54
+
2. On the following page, the base branch is automatically set to the head of the topmost PR. Select the head branch for your new PR and click **Create pull request**.
55
55
56
56

57
57
@@ -79,7 +79,7 @@ Before a PR in the stack can be merged, the following conditions must be met:
79
79
80
80
## Unstacking
81
81
82
-
If you want to reorder or reorganize the PRs in a stack, you must first dissolve the stack and then recreate it. You can unstack PRs from the UI.
82
+
If you want to reorder or reorganize the PRs in a stack, you must first dissolve the stack and then re-create it. You can unstack PRs from the UI.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/workflows.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,7 +135,7 @@ This command:
135
135
4. Pushes the updated branches
136
136
5. Syncs PR state from GitHub
137
137
138
-
If a conflict is detected during the rebase, all branches are restored to their original state and you're advised to run `gh stack rebase` to resolve conflicts interactively.
138
+
If a conflict is detected during the rebase, all branches are restored to their original state, and you're advised to run `gh stack rebase` to resolve conflicts interactively.
Copy file name to clipboardExpand all lines: docs/src/content/docs/introduction/overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ While the PR UI provides the review and merge experience, the `gh stack` CLI han
91
91
-**Tearing down stacks** — `gh stack unstack` removes a stack from GitHub and local tracking if you need to restructure it.
92
92
-**Checking out a stack** — `gh stack checkout <pr-number>` pulls down a stack, with all its branches, from GitHub to your local machine.
93
93
94
-
The CLI is not required to use Stacked PRs — the underlying git operations are standard. But it makes the workflow simpler, and you can create Stacked PRs from CLI instead of the UI.
94
+
The CLI is not required to use Stacked PRs — the underlying git operations are standard. But it makes the workflow simpler, and you can create Stacked PRs from the CLI instead of the UI.
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/cli.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,7 @@ Check out a stack from a pull request number or branch name.
138
138
gh stack checkout [<pr-number>|<branch>]
139
139
```
140
140
141
-
When a PR number is provided (e.g. `123`), the command fetches the stack on GitHub, pulls the branches, and sets up the stack locally. If the stack already exists locally and matches, it switches to the branch. If the local and remote stacks have different compositions, you'll be prompted to resolve the conflict.
141
+
When a PR number is provided (e.g.,`123`), the command fetches the stack on GitHub, pulls the branches, and sets up the stack locally. If the stack already exists locally and matches, it switches to the branch. If the local and remote stacks have different compositions, you'll be prompted to resolve the conflict.
142
142
143
143
When a branch name is provided, the command resolves it against locally tracked stacks only.
144
144
@@ -197,11 +197,11 @@ gh stack sync [flags]
197
197
198
198
Performs a safe, non-interactive synchronization of the entire stack:
199
199
200
-
1.**Fetch** — fetches the latest changes from `origin`
201
-
2.**Fast-forward trunk** — fast-forwards the trunk branch to match the remote (skips if diverged)
202
-
3.**Cascade rebase** — rebases all stack branches onto their updated parents (only if trunk moved). If a conflict is detected, all branches are restored to their original state and you are advised to run `gh stack rebase` to resolve conflicts interactively
203
-
4.**Push** — pushes all branches (uses `--force-with-lease` if a rebase occurred)
204
-
5.**Sync PRs** — syncs PR state from GitHub and reports the status of each PR
200
+
1.**Fetch** — fetches the latest changes from `origin`.
201
+
2.**Fast-forward trunk** — fast-forwards the trunk branch to match the remote (skips if diverged).
202
+
3.**Cascade rebase** — rebases all stack branches onto their updated parents (only if trunk moved). If a conflict is detected, all branches are restored to their original state, and you are advised to run `gh stack rebase` to resolve conflicts interactively.
203
+
4.**Push** — pushes all branches (uses `--force-with-lease` if a rebase occurred).
204
+
5.**Sync PRs** — syncs PR state from GitHub and reports the status of each PR.
0 commit comments