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
Copy file name to clipboardExpand all lines: README.md
+35-42Lines changed: 35 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,14 @@ gh stack add auth-layer
34
34
gh stack add api-endpoints
35
35
# ... make commits ...
36
36
37
-
# Push all branches and create/update PRs
37
+
# Push all branches
38
38
gh stack push
39
39
40
40
# View the stack
41
41
gh stack view
42
+
43
+
# Open a stack of PRs
44
+
gh stack submit
42
45
```
43
46
44
47
## How it works
@@ -55,7 +58,7 @@ main (trunk)
55
58
56
59
The **bottom** of the stack is the branch closest to the trunk, and the **top** is the branch furthest from it. Each branch inherits from the one below it. Navigation commands (`up`, `down`, `top`, `bottom`) follow this model: `up` moves away from trunk, `down` moves toward it.
57
60
58
-
When you push, `gh stack` creates one PR per branch. Each PR's base is set to the branch below it in the stack, so reviewers see only the diff for that layer.
61
+
When you submit, `gh stack` creates one PR per branch and links them together as a **Stack** on GitHub. Each PR's base is set to the branch below it in the stack, so reviewers see only the diff for that layer.
59
62
60
63
### Local tracking
61
64
@@ -253,84 +256,74 @@ gh stack sync
253
256
254
257
### `gh stack push`
255
258
256
-
Push all branches in the current stack and create or update pull requests.
259
+
Push all branches in the current stack to the remote.
257
260
258
261
```
259
262
gh stack push [flags]
260
263
```
261
264
262
-
Pushes every branch to the remote, then for each branch either creates a new PR (with the correct base branch) or updates the base of an existing PR if it has changed. Uses `--force-with-lease` by default to safely update rebased branches.
263
-
264
-
When creating new PRs, you will be prompted to enter a title for each one. Press Enter to accept the default (branch name), or use `--auto` to skip prompting entirely.
265
+
Pushes every branch to the remote using `--force-with-lease --atomic`. This is a lightweight wrapper around `git push` that knows about all branches in the stack. It does not create or update pull requests — use `gh stack submit` for that.
265
266
266
267
| Flag | Description |
267
268
|------|-------------|
268
-
|`--auto`| Use auto-generated PR titles without prompting |
269
-
|`--draft`| Create new PRs as drafts |
270
-
|`--skip-prs`| Push branches without creating or updating PRs |
271
269
|`--remote <name>`| Remote to push to (defaults to auto-detected remote) |
272
270
273
271
**Examples:**
274
272
275
273
```sh
276
274
gh stack push
277
-
gh stack push --auto
278
-
gh stack push --draft
279
-
gh stack push --skip-prs
275
+
gh stack push --remote upstream
280
276
```
281
277
282
-
### `gh stack view`
278
+
### `gh stack submit`
283
279
284
-
View the current stack.
280
+
Push all branches and create/update PRs and the stack on GitHub.
285
281
286
282
```
287
-
gh stack view [flags]
283
+
gh stack submit [flags]
288
284
```
289
285
290
-
Shows all branches in the stack, their ordering, PR links, and the most recent commit with a relative timestamp. Output is piped through a pager (respects `GIT_PAGER`, `PAGER`, or defaults to `less -R`).
286
+
Creates a Stacked PR for every branch in the stack, pushing branches to the remote.
287
+
288
+
After creating PRs, `submit` automatically creates a **Stack** on GitHub to link the PRs together. If the stack already exists on GitHub (e.g., from a previous submit), new PRs will be added to the top of the stack.
289
+
290
+
When creating new PRs, you will be prompted to enter a title for each one. Press Enter to accept the default (branch name), or use `--auto` to skip prompting entirely.
|`--auto`| Use auto-generated PR titles without prompting |
295
+
|`--draft`| Create new PRs as drafts |
296
+
|`--remote <name>`| Remote to push to (defaults to auto-detected remote) |
296
297
297
298
**Examples:**
298
299
299
300
```sh
300
-
gh stack view
301
-
gh stack view --short
302
-
gh stack view --json
301
+
gh stack submit
302
+
gh stack submit --auto
303
+
gh stack submit --draft
303
304
```
304
305
305
-
### `gh stack unstack`
306
+
### `gh stack view`
306
307
307
-
Remove a stack from local tracking and optionally delete it on GitHub.
308
+
View the current stack.
308
309
309
310
```
310
-
gh stack unstack [branch] [flags]
311
+
gh stack view [flags]
311
312
```
312
313
313
-
If no branch is specified, uses the current branch to find the stack. By default, the stack is removed from both local tracking and GitHub. Use `--local` to only remove the local tracking entry.
314
+
Shows all branches in the stack, their ordering, PR links, and the most recent commit with a relative timestamp. Output is piped through a pager (respects `GIT_PAGER`, `PAGER`, or defaults to `less -R`).
314
315
315
316
| Flag | Description |
316
317
|------|-------------|
317
-
|`--local`| Only delete the stack locally (keep it on GitHub) |
318
-
319
-
| Argument | Description |
320
-
|----------|-------------|
321
-
|`[branch]`| A branch in the stack to delete (defaults to the current branch) |
# → feat/02 already has commits, creates feat/03 and commits there
451
444
452
445
# 7. Push everything and create PRs
453
-
gh stack push
446
+
gh stack submit
454
447
```
455
448
456
449
Compared to the typical workflow, there's no need to name branches, run `git add`, or run `git commit` separately. Each `gh stack add -Am "..."` does it all.
0 commit comments