Skip to content

Commit d7d2bb9

Browse files
committed
docs updates
1 parent 77478f2 commit d7d2bb9

8 files changed

Lines changed: 25 additions & 14 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Interactively restructure the current stack.
245245
gh stack modify [flags]
246246
```
247247

248-
Opens a terminal UI for restructuring a stack. You can rename, drop, reorder, and fold branches into adjacent ones. All the changes are staged during the preview and applied at once on save.
248+
Opens a terminal UI for restructuring a stack. You can drop, fold, insert, rename, and reorder branches. All the changes are staged during the preview and applied at once on save.
249249

250250
If the stack of PRs has been created on GitHub, run `gh stack submit` afterwards to push the changes and recreate the stack.
251251

@@ -259,6 +259,7 @@ If the stack of PRs has been created on GitHub, run `gh stack submit` afterwards
259259
- **Drop** (`x`): Remove a branch and its commits from the stack. Local branch and associated PR are preserved.
260260
- **Fold down** (`d`): Absorb a branch's commits into the branch below (toward trunk). Folded branch removed from stack.
261261
- **Fold up** (`u`): Absorb a branch's commits into the branch above (away from trunk). Folded branch removed from stack.
262+
- **Insert** (`i`/`I`): Insert a new empty branch into the stack. `i` inserts below the cursor; `I` inserts above.
262263
- **Reorder** (`Shift+↑`/`Shift+↓`): Move a branch up (away from trunk) or down (toward trunk) in the stack.
263264
- **Rename** (`r`): Rename a branch locally and in the stack metadata.
264265
- **Undo** (`z`): Undo the last staged action.
@@ -272,7 +273,8 @@ If the stack of PRs has been created on GitHub, run `gh stack submit` afterwards
272273
| `c` | View commits |
273274
| `x` | Drop branch |
274275
| `r` | Rename branch |
275-
| `u/d` | Fold branch up/down |
276+
| `i/I` | Insert branch below/above |
277+
| `d/u` | Fold branch down/up |
276278
| `Shift+↑`/`Shift+↓` | Move branch up/down |
277279
| `z` | Undo last action |
278280
| `Ctrl+S` | Apply all changes |
-131 KB
Loading

docs/src/content/docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ 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-
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.
36+
Use `gh stack modify` to restructure a stack. It opens an interactive terminal UI where you can reorder, drop, fold (combine), insert, and rename branches — then applies all changes at once. See the [Restructuring Stacks](/gh-stack/guides/modify/) guide for a full walkthrough.
3737

3838
Alternatively, you can manually tear down and re-create the stack with `gh stack unstack` and `gh stack init`:
3939

4040
```sh
4141
# 1. Remove the stack
4242
gh stack unstack
4343

44-
# 2. Make structural changes (reorder, rename, delete branches)
44+
# 2. Make structural changes (reorder, rename, insert, delete branches)
4545
git branch -m api-roots api-routes
4646

4747
# 3. Re-create the stack with the new structure

docs/src/content/docs/guides/modify.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Restructuring Stacks
33
description: How to use `gh stack modify` to restructure a stack.
44
---
55

6-
`gh stack modify` provides an interactive terminal UI for restructuring a stack locally. You can drop, fold, rename, and reorder branches and then apply all your changes at once.
6+
`gh stack modify` provides an interactive terminal UI for restructuring a stack locally. You can drop, fold, insert, rename, and reorder branches and then apply all your changes at once.
77

88
![The modify stack terminal UI](../../../assets/screenshots/modify-stack-tui.png)
99

@@ -12,6 +12,7 @@ description: How to use `gh stack modify` to restructure a stack.
1212
Use `modify` when you need to:
1313
- **Remove** a branch from the stack
1414
- **Combine** two branches into one
15+
- **Insert** a new branch into the stack
1516
- **Rename** a branch
1617
- **Reorder** branches
1718

@@ -46,21 +47,25 @@ Absorbs the selected branch's commits into the branch below it (toward trunk) vi
4647

4748
Absorbs the selected branch's commits into the branch above it (away from trunk). Since the branch above already contains the folded branch's commits in its history, this is handled by adjusting what is considered the first unique commit for the branch. The folded branch is removed from the stack.
4849

50+
### Insert below / above (`i` / `I`)
51+
52+
Inserts a new empty branch into the stack at the cursor position. Lowercase `i` inserts below the cursor (toward trunk); uppercase `I` inserts above the cursor (away from trunk). An inline prompt appears to enter the new branch name. The branch is created at apply time, pointing at the parent branch's tip.
53+
4954
### Rename (`r`)
5055

5156
Opens an inline prompt to enter a new name for the branch. The branch is renamed locally and in the stack metadata. On the next `submit`, the new branch name is pushed to GitHub.
5257

5358
### Reorder (`Shift+↑`/`Shift+↓`)
5459

55-
Moves the selected branch up (away from trunk) or down (toward trunk) in the stack. A cascading rebase adjusts all affected branches. Note: reordering and structural changes (drop/fold/rename) cannot be mixed in the same session.
60+
Moves the selected branch up (away from trunk) or down (toward trunk) in the stack. A cascading rebase adjusts all affected branches. Note: reordering and structural changes (drop/fold/insert/rename) cannot be mixed in the same session.
5661

5762
### Undo (`z`)
5863

5964
Reverses the most recent staged action. You can undo multiple times to step back through your changes.
6065

6166
## Applying changes
6267

63-
Press `Ctrl+S` to apply all staged changes. Nothing is modified until you save. The apply phase renames branches, folds/drops branches, and runs a cascading rebase to create a linear commit history with the desired stack state.
68+
Press `Ctrl+S` to apply all staged changes. Nothing is modified until you save. The apply phase renames branches, inserts new branches, folds/drops branches, and runs a cascading rebase to create a linear commit history with the desired stack state.
6469

6570
### Handling conflicts
6671

@@ -94,8 +99,7 @@ This also works if `modify` was interrupted (e.g., terminal crash). A pre-modify
9499
## Limitations
95100

96101
- Cannot modify merged branches (they are locked)
97-
- Cannot add new branches (use `gh stack add` instead)
98102
- Cannot split a branch into multiple branches
99103
- Cannot move branches between different stacks
100104
- Requires an interactive terminal
101-
- Reordering and structural changes (drop/fold/rename) cannot be mixed in the same session
105+
- Reordering and structural changes (drop/fold/insert/rename) cannot be mixed in the same session

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Commits created by a server-side rebase are **not signed**. If your repository r
9393

9494
## Unstacking
9595

96-
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.
96+
If you want to reorder or reorganize the PRs in a stack from the UI, you must first dissolve the stack and then re-create it. For CLI users, `gh stack modify` provides an interactive way to [restructure a stack](/gh-stack/guides/modify/) — including reordering, inserting, dropping, and renaming branches — without needing to dissolve it.
9797

9898
### Dissolving the Entire Stack
9999

docs/src/content/docs/guides/workflows.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ All branches in a stack should be part of the same feature or project. If you ne
299299

300300
## Restructuring a Stack
301301

302-
When you need to change the composition of a stack — remove a branch, combine branches, change the order, or rename a branch — use `gh stack modify`:
302+
When you need to change the composition of a stack — remove a branch, combine branches, insert a new branch, change the order, or rename a branch — use `gh stack modify`:
303303

304304
```sh
305305
# Open the modify TUI
@@ -309,6 +309,8 @@ gh stack modify
309309
# x → drop a branch
310310
# d → fold down (into branch below)
311311
# u → fold up (into branch above)
312+
# i → insert below
313+
# I → insert above
312314
# Shift+↑/↓ → reorder
313315
# r → rename
314316
# z → undo

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ While the PR UI provides the review and merge experience, the `gh stack` CLI han
8989
- **Creating PRs**`gh stack submit` pushes branches and creates or updates PRs, linking them as a Stack on GitHub.
9090
- **Navigating the stack**`gh stack up`, `down`, `top`, and `bottom` let you move between layers without remembering branch names.
9191
- **Syncing everything**`gh stack sync` fetches, rebases, pushes, and updates PR state in one command.
92-
- **Tearing down stacks**`gh stack unstack` removes a stack from GitHub and local tracking if you need to restructure it.
92+
- **Restructuring stacks**`gh stack modify` opens an interactive terminal UI to drop, fold, insert, rename, and reorder branches in a stack.
93+
- **Tearing down stacks**`gh stack unstack` removes a stack from GitHub and local tracking.
9394
- **Checking out a stack**`gh stack checkout <pr-number>` pulls down a stack, with all its branches, from GitHub to your local machine.
9495

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

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,16 @@ The command checks these conditions before opening the TUI:
192192
| Drop | `x` | Remove branch and its commits from stack. Local branch and associated PR are preserved. |
193193
| Fold down | `d` | Absorb commits into branch below (toward trunk). Folded branch removed from stack. |
194194
| Fold up | `u` | Absorb commits into branch above (away from trunk). Folded branch removed from stack. |
195+
| Insert below | `i` | Insert a new empty branch below the cursor (toward trunk). |
196+
| Insert above | `I` | Insert a new empty branch above the cursor (away from trunk). |
195197
| Move down | `Shift+↓` | Reorder branch down (toward trunk) in the stack |
196198
| Move up | `Shift+↑` | Reorder branch up (away from trunk) in the stack |
197199
| Rename | `r` | Rename the branch (opens inline prompt) |
198200
| Undo | `z` | Undo the last staged action |
199201

200202
**Apply phase:**
201203

202-
When you press `Ctrl+S`, the staged changes are applied by renaming branches, folding/dropping branches, and running a cascading rebase to create a linear commit history with the desired stack state.
204+
When you press `Ctrl+S`, the staged changes are applied by renaming branches, inserting new branches, folding/dropping branches, and running a cascading rebase to create a linear commit history with the desired stack state.
203205

204206
If a rebase conflict occurs, you can:
205207
- Resolve conflicts, stage files, and run `gh stack modify --continue`
@@ -234,7 +236,7 @@ You must have a branch from the stack checked out locally. The command targets t
234236

235237
Deletes the stack on GitHub first, if it exists, then removes it from local tracking. If the remote deletion fails, the local state is left untouched so you can retry. Use `--local` to skip the remote deletion and only remove local tracking.
236238

237-
This is useful when you need to restructure a stack — remove a branch, reorder branches, rename branches, or make other large changes. After unstacking, use `gh stack init` to re-create the stack with the desired structure — existing branches are adopted automatically.
239+
This is useful when you need to restructure a stack — remove a branch, insert a branch, reorder branches, rename branches, or make other large changes. After unstacking, use `gh stack init` to re-create the stack with the desired structure — existing branches are adopted automatically.
238240

239241
| Flag | Description |
240242
|------|-------------|

0 commit comments

Comments
 (0)