Skip to content

Commit f545521

Browse files
committed
docs updates
1 parent 8c86909 commit f545521

9 files changed

Lines changed: 38 additions & 29 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Stack metadata is stored in `.git/gh-stack` (a JSON file, not committed to the r
6969
Initialize a new stack in the current repository.
7070

7171
```
72-
gh stack init [branches...] [flags]
72+
gh stack init [flags] [branches...]
7373
```
7474

7575
Creates an entry in `.git/gh-stack` to track stack state. In interactive mode (no arguments), prompts you to name branches and offers to use the current branch as the first layer. In interactive mode, you'll also be prompted to set an optional branch prefix (unless adopting existing branches). When a prefix is set, branch names you enter are automatically prefixed. When explicit branch names are given, creates any that don't already exist (branching from the trunk). The trunk defaults to the repository's default branch unless overridden with `--base`.
@@ -115,7 +115,7 @@ gh stack init -p feat --numbered
115115
Add a new branch on top of the current stack.
116116

117117
```
118-
gh stack add [branch] [flags]
118+
gh stack add [flags] [branch]
119119
```
120120

121121
Creates a new branch at the current HEAD, adds it to the top of the stack, and checks it out. Must be run while on the topmost branch of a stack. If no branch name is given, prompts for one.
@@ -190,7 +190,7 @@ gh stack checkout
190190
Pull from remote and do a cascading rebase across the stack.
191191

192192
```
193-
gh stack rebase [branch] [flags]
193+
gh stack rebase [flags] [branch]
194194
```
195195

196196
Fetches the latest changes from `origin`, then ensures each branch in the stack has the tip of the previous layer in its commit history. Rebases branches in order from trunk upward. If a branch's PR has been squash-merged, the rebase automatically switches to `--onto` mode to correctly replay commits on top of the merge target.
@@ -331,7 +331,7 @@ gh stack view --json
331331
Remove a stack from local tracking and delete it on GitHub. Also available as `gh stack delete`.
332332

333333
```
334-
gh stack unstack [branch] [flags]
334+
gh stack unstack [flags] [branch]
335335
```
336336

337337
If no branch is specified, uses the current branch to find the stack. Deletes the stack on GitHub first, then removes local tracking. Use `--local` to only remove the local tracking entry.
@@ -414,7 +414,7 @@ gh stack feedback "Support for reordering branches"
414414
Create a short command alias so you can type less.
415415

416416
```
417-
gh stack alias [name] [flags]
417+
gh stack alias [flags] [name]
418418
```
419419

420420
Installs a small wrapper script into `~/.local/bin/` that forwards all arguments to `gh stack`. The default alias name is `gs`, but you can choose any name by passing it as an argument. After setup, you can run `gs push` instead of `gh stack push`.
Binary file not shown.
2.18 KB
Loading

docs/src/content/docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Yes, you can continue to use your tool of choice (e.g. jj, Sapling, ghstack, git
158158

159159
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.
160160

161-
You can also use the GitHub CLI in conjunction with other tools to simply create a stack of PRs:
161+
You can also use the GitHub CLI in conjunction with other tools to open your PRs as a stack:
162162

163163
```bash
164164
# Create a stack of branches locally using jj

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Before a PR in the stack can be merged, the following conditions must be met:
7575
- **The stack must be fully rebased** with a linear history
7676
- **The current PR itself** must meet all branch protection requirements for the stack base
7777

78-
![Merge box showing failing stack requirements](../../../assets/screenshots/merge-box-failing-stack-requirements.png)
78+
![Merge box for a stacked pull request](../../../assets/screenshots/stack-merge-box.png)
7979

8080
## Unstacking
8181

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gh stack rebase
3333
# 7. Push the updated branches
3434
gh stack push
3535

36-
# 8. When the first PR is merged, sync the stack
36+
# 8. Sync upstream changes as PRs get merged
3737
gh stack sync
3838
```
3939

@@ -42,34 +42,37 @@ gh stack sync
4242
For speed, use a branch prefix with `--numbered` and the `-Am` flags to fold staging, committing, and branch creation into a single command. Branch names are auto-generated as `prefix/01`, `prefix/02`, etc.
4343

4444
```sh
45+
# Alias `gh stack` as `gs` for easier use
46+
gh stack alias
47+
4548
# 1. Start a stack with numbered branches
46-
gh stack init -p feat --numbered
49+
gs init -p feat --numbered
4750
# → creates feat/01 and checks it out
4851

4952
# 2. Write code for the first layer
5053
# ... write code ...
5154

5255
# 3. Stage and commit on the current branch
53-
gh stack add -Am "Auth middleware"
56+
gs add -Am "Auth middleware"
5457
# → feat/01 has no commits yet, so the commit lands here
5558

5659
# 4. Write code for the next layer
5760
# ... write code ...
5861

5962
# 5. Create the next branch and commit
60-
gh stack add -Am "API routes"
63+
gs add -Am "API routes"
6164
# → feat/01 already has commits, so feat/02 is created
6265

6366
# 6. Keep going
6467
# ... write code ...
65-
gh stack add -Am "Frontend components"
68+
gs add -Am "Frontend components"
6669
# → creates feat/03
6770

6871
# 7. Push everything and create PRs
69-
gh stack submit
72+
gs submit
7073
```
7174

72-
Each `gh stack add -Am "..."` stages all files, commits, and (if the current branch already has commits) creates a new branch — no separate `git add` or `git commit` needed.
75+
Each `gs add -Am "..."` stages all files, commits, and (if the current branch already has commits) creates a new branch — no separate `git add` or `git commit` needed.
7376

7477
## Making Mid-Stack Changes
7578

docs/src/content/docs/index.mdx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,42 @@ A **stack** is a series of pull requests in the same repository where each PR ta
4747
<Image src={stackDiagram} alt="A stack of pull requests: main at the bottom, with auth-layer (PR #1), api-endpoints (PR #2), and frontend (PR #3) stacked on top" />
4848
</div>
4949

50-
GitHub understands stacks end-to-end: the pull request UI shows a **stack map** so reviewers can navigate between layers, branch protection rules are enforced against the **final target branch** (not just the direct base), and CI runs for every PR in the stack.
50+
GitHub understands stacks end-to-end: the pull request UI shows a **stack map** so reviewers can navigate between layers, branch protection rules are enforced against the **final target branch** (not just the direct base), and CI runs for every PR in the stack as if they were targeting the final branch.
5151

5252
<div style="max-width: 600px; margin: 1.5rem auto;">
5353
<Image src={stackNavigator} alt="The stack navigator in a pull request header" />
5454
</div>
5555

5656
## How It Works
5757

58-
The `gh stack` CLI handles the local workflow: creating branches, keeping them rebased, pushing to GitHub, and creating PRs with the correct base branches. On GitHub, the PR UI gives reviewers the context they need — a stack map for navigation, focused diffs for each layer, and proper rules enforcement.
58+
The `gh stack` CLI handles the local workflow: creating branches, managing rebases, pushing to GitHub, and creating PRs with the correct base branches. On GitHub, the PR UI gives reviewers the context they need — a stack map for navigation, focused diffs for each layer, and proper rules enforcement.
5959

60-
When you're ready to merge, you merge from the bottom up. Each PR can be merged directly or through the merge queue. When a PR at the bottom is merged, the remaining stack is automatically rebased so the next PR targets `main` and is ready for its own merge.
60+
When you're ready to merge, you can merge all or a part of the stack. Each PR can be merged directly or through the merge queue. After a merge, the remaining PRs in the stack are automatically rebased so the lowest unmerged PR targets the base branch.
6161

6262
## Get Started
6363

6464
```sh
6565
# Install the CLI extension
6666
gh extension install github/gh-stack
6767

68-
# Create a stack (creates and checks out the first branch)
69-
gh stack init auth-layer
68+
# Alias `gh stack` as `gs` for easier use (optional)
69+
gh stack alias
70+
71+
# Start a stack (creates and checks out the first branch)
72+
gs init auth-layer
7073
# ... make commits ...
71-
gh stack add api-routes
74+
75+
# Create new layers in the stack (creates and checks out each new branch)
76+
gs add api-routes
7277
# ... make commits ...
73-
gh stack add frontend
78+
gs add frontend
7479
# ... make commits ...
7580

7681
# Push all branches
77-
gh stack push
82+
gs push
7883

7984
# Open a stack of PRs
80-
gh stack submit
85+
gs submit
8186
```
8287

8388
Ready to dive in? Start with the [Quick Start guide](/gh-stack/getting-started/quick-start/) or read the [full overview](/gh-stack/introduction/overview/).

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Overview
33
description: What stacked pull requests are, why they matter, and how GitHub supports them natively.
44
---
55

6-
## The Challenge
6+
## Why Stacks?
77

88
For developers who want to break large changes into smaller, dependent parts, the experience can be painful:
99

@@ -89,8 +89,9 @@ While the PR UI provides the review and merge experience, the `gh stack` CLI han
8989
- **Navigating the stack**`gh stack up`, `down`, `top`, and `bottom` let you move between layers without remembering branch names.
9090
- **Syncing everything**`gh stack sync` fetches, rebases, pushes, and updates PR state in one command.
9191
- **Tearing down stacks**`gh stack unstack` removes a stack from GitHub and local tracking if you need to restructure it.
92+
- **Checking out a stack**`gh stack checkout <pr-number>` pulls down a stack, with all its branches, from GitHub to your local machine.
9293

93-
The CLI is not required to use Stacked PRs — the underlying git operations are standard. But it makes the workflow dramatically simpler.
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.
9495

9596
## Thinking About Stack Structure
9697

skills/gh-stack/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ gh stack init --base main --adopt new-branch-1 new-branch-2 new-branch-3
381381
Creates a new stack. Provide branch names as positional arguments.
382382

383383
```
384-
gh stack init [branches...] [flags]
384+
gh stack init [flags] [branches...]
385385
```
386386

387387
```bash
@@ -424,7 +424,7 @@ gh stack init --adopt branch-a branch-b branch-c
424424
Add a new branch on top of the current stack. Must be run while on the topmost branch (or the trunk if the stack has no branches yet). Always provide an explicit branch name.
425425

426426
```
427-
gh stack add [branch] [flags]
427+
gh stack add [flags] [branch]
428428
```
429429

430430
**Recommended workflow — create the branch, then use standard git:**
@@ -578,7 +578,7 @@ gh stack sync [flags]
578578
Pull from remote and cascade-rebase stack branches. Use this when `sync` reports a conflict or when you need finer control (e.g., rebase only part of the stack).
579579

580580
```
581-
gh stack rebase [branch] [flags]
581+
gh stack rebase [flags] [branch]
582582
```
583583

584584
```bash
@@ -730,7 +730,7 @@ When a branch name is provided, the command resolves it against locally tracked
730730
Tear down a stack so you can restructure it — 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.
731731

732732
```
733-
gh stack unstack [branch] [flags]
733+
gh stack unstack [flags] [branch]
734734
```
735735

736736
```bash

0 commit comments

Comments
 (0)