Skip to content

Commit 3700f4e

Browse files
skarimCopilot
andauthored
docs content updates (#83)
* update faq content * clarify auth requirement for cli * docs on rebase stack button behavior * update header level Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * clarify TUI acronym --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent de00856 commit 3700f4e

5 files changed

Lines changed: 37 additions & 11 deletions

File tree

docs/src/content/docs/faq.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ You can also add PRs to an existing stack from the GitHub UI. See [Adding to an
3333

3434
### How can I modify my stack?
3535

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`:
36+
Use `gh stack modify` to restructure a stack. It opens an interactive terminal UI where you can reorder, drop, fold (combine), and rename branches — then applies all changes at once. See the [Restructuring Stacks](/gh-stack/guides/modify/) guide for a full walkthrough.
37+
38+
Alternatively, you can manually tear down and re-create the stack with `gh stack unstack` and `gh stack init --adopt`:
3739

3840
```sh
3941
# 1. Remove the stack
@@ -43,7 +45,7 @@ gh stack unstack
4345
git branch -m old-name new-name
4446

4547
# 3. Re-create the stack with the new structure
46-
gh stack init --adopt branch-2 branch-1 branch-3
48+
gh stack init --adopt branch-1 branch-2 branch-3
4749
```
4850

4951
### How do I delete my stack?
@@ -111,7 +113,7 @@ Yes. There must be a **fully linear history** between each of the branches in th
111113
If the stack is not linear (e.g., after changes were pushed to a lower branch), you can fix it in two ways:
112114

113115
- **From the CLI** — Run `gh stack rebase` to perform a cascading rebase locally and then push with `gh stack push`.
114-
- **From the UI** — Click the **Rebase Stack** button in the merge box to trigger a cascading rebase across all branches in the stack.
116+
- **From the UI** — Click the **Rebase Stack** button in the merge box to trigger a server-side cascading rebase. This rebases the entire stack on top of the latest trunk, updates every unmerged branch on top of its base branch, and force-pushes the results. See [Rebasing from the UI](/gh-stack/guides/ui/#rebasing-from-the-ui) for details.
115117

116118
## Merging Stacked PRs
117119

@@ -121,11 +123,13 @@ Every PR in a stack must meet the same merge requirements as a PR targeting the
121123

122124
### How does merging a stack of PRs differ from merging a regular PR?
123125

124-
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.
126+
Stacks merge from the bottom up as a single atomic operation. When you click merge on a PR in a stack, that PR and all unmerged PRs below it land on the base branch together. PRs above remain open, and the remaining stack is automatically rebased so the next PR targets `main` directly.
125127

126128
### What happens when you merge a PR in the middle of the stack?
127129

128-
You cannot merge a PR in the middle of the stack before the PRs below it are merged. PRs must be merged in order from the bottom up.
130+
When you click merge on a PR in the middle of the stack, that PR and all unmerged PRs below it land on the base branch together as a single atomic operation, ordered from the bottom up in the resulting history. PRs above the selected one remain open. After the merge, the lowest unmerged PR is updated to target the stack base directly, and a cascading rebase runs across the remaining branches.
131+
132+
It is not possible to merge a middle PR in isolation: the PRs below it always merge with it.
129133

130134
### How does squash merge work?
131135

@@ -171,13 +175,13 @@ When you merge a stack using the merge commit strategy, it creates **one merge c
171175
172176
### How does rebase merge work?
173177
174-
With rebase merge, all of the commits from each PR in the stack are replayed onto the base branch one at a time, creating a linear history without merge commits.
178+
With rebase merge, the commits from each PR in the stack are replayed onto the base branch, creating a linear history without merge commits. The full set of commits lands as a single atomic operation.
175179
176180
### Do all PRs get merged at once or one at a time?
177181
178-
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.
182+
All PRs in the stack land in a single atomic operation. When you click merge on a PR, that PR and all unmerged PRs below it are merged together onto the base branch at the same time, ordered from the bottom up in the resulting history. PRs above the selected one remain open.
179183
180-
Commits are not all landed in a single atomic operation — each PR is merged individually in sequence.
184+
This applies whether or not a merge queue is enabled. With a merge queue, the same atomic landing happens once the stack's merge group reaches the front of the queue.
181185
182186
### Can I merge only part of a stack? What happens to the remaining unmerged PRs?
183187
@@ -189,15 +193,15 @@ Closing a PR in the middle of the stack will block all PRs above it from being m
189193
190194
### What happens when there is an error merging a PR in the middle of a stack?
191195
192-
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.
196+
Pre-merge checks run before any merge attempt, but a merge can still fail (e.g., due to an unexpected merge conflict or intermittent failure). If a failure occurs partway through, merging stops at that PR. PRs below it that successfully merged remain landed on the base branch; the failed PR and PRs above it stay open. Resolve the issue on the failed PR and retry to land the rest of the stack.
193197
194198
### Do Stacked PRs support merge queue?
195199
196200
Yes, Stacked PRs fully support merging via merge queue. When you merge a stack through the merge queue:
197201
198202
- **All PRs in the stack are added to the queue** in the correct order, ensuring a linear sequence.
199203
- **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.
200-
- **Stacks can be split across merge groups** in the merge queue — not all PRs in the stack need to be in the same merge group.
204+
- **Stacks are kept in the same merge group on a best-effort basis.** To keep a stack together, the merge queue allows the merge group to exceed its configured max size by up to 50%. If the stack is too large to fit within that buffer, it splits across consecutive merge groups: as much of the stack as fits goes into the current group, and the remaining PRs continue in subsequent groups until the full stack has landed.
201205
202206
## Local Development
203207

docs/src/content/docs/getting-started/quick-start.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Stacked PRs is currently in private preview. This feature will **not work** unle
1919
gh extension install github/gh-stack
2020
```
2121

22+
:::note[Authentication]
23+
The `gh stack` CLI requires OAuth authentication via `gh auth login`. Personal access tokens (PATs) are not supported.
24+
:::
25+
2226
## Set Up AI Agent Integration
2327

2428
If you use AI coding agents (like GitHub Copilot), install the gh-stack skill so they know how to work with Stacked PRs:

docs/src/content/docs/guides/ui.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ Before a PR in the stack can be merged, the following conditions must be met:
7777

7878
![Merge box for a stacked pull request](../../../assets/screenshots/stack-merge-box.png)
7979

80+
### Rebasing from the UI
81+
82+
When the stack is not linear (e.g., after changes were pushed to a lower branch, or after `main` has moved ahead), a **Rebase Stack** button appears in the merge box. Clicking it triggers a server-side cascading rebase that:
83+
84+
1. Rebases the entire stack on top of the latest trunk (e.g., `main`) HEAD.
85+
2. Rebases every unmerged branch on top of the latest changes from its base branch, working from the bottom of the stack upward.
86+
3. Force-pushes each rebased branch to update the remote.
87+
88+
After the rebase completes, all PRs in the stack reflect the updated branches and CI checks are re-triggered.
89+
90+
:::note[Commit signing]
91+
Commits created by a server-side rebase are **not signed**. If your repository requires signed commits, we recommend using the CLI. Running `gh stack rebase` uses local git operations, so the generated commits will follow your local git signing configuration. After rebasing locally, you can force push your updated branches with `gh stack push`.
92+
:::
93+
8094
## Unstacking
8195

8296
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.

docs/src/content/docs/introduction/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Stacks support all three merge methods:
7474

7575
Rebasing is the trickiest part of working with Stacked PRs, and GitHub handles it automatically:
7676

77-
- **In the PR UI** — A rebase button lets you trigger a cascading rebase across all branches in the stack.
77+
- **In the PR UI** — A **Rebase Stack** button lets you trigger a server-side cascading rebase. It rebases the entire stack on top of the latest trunk, updates every unmerged branch, and force-pushes the results. See [Rebasing from the UI](/gh-stack/guides/ui/#rebasing-from-the-ui) for details.
7878
- **From the CLI**`gh stack rebase` performs the same cascading rebase locally.
7979
- **After partial merges** — When you merge a PR at the bottom of the stack, the remaining branches are automatically rebased so the next PR targets `main` and is ready for review and merge.
8080
- **Safe squash-merge handling** — Squash merges are fully supported. The rebase engine safely replays your unique commits on top of the squashed base, avoiding artificial merge conflicts. See the [FAQ](/gh-stack/faq/#how-does-squash-merge-work) for a detailed description of how this works.

docs/src/content/docs/reference/cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ gh extension install github/gh-stack
1111

1212
Requires the [GitHub CLI](https://cli.github.com/) (`gh`) v2.0+.
1313

14+
:::note[Authentication]
15+
The `gh stack` CLI requires OAuth authentication via `gh auth login`. Personal access tokens (PATs) are not supported.
16+
:::
17+
1418
---
1519

1620
## Stack Management

0 commit comments

Comments
 (0)