Skip to content

Commit d4967d8

Browse files
committed
submit command
1 parent 891f51f commit d4967d8

11 files changed

Lines changed: 1043 additions & 642 deletions

File tree

README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ gh stack add auth-layer
3434
gh stack add api-endpoints
3535
# ... make commits ...
3636

37-
# Push all branches and create/update PRs
37+
# Push all branches
3838
gh stack push
3939

4040
# View the stack
4141
gh stack view
42+
43+
# Open a stack of PRs
44+
gh stack submit
4245
```
4346

4447
## How it works
@@ -253,32 +256,51 @@ gh stack sync
253256

254257
### `gh stack push`
255258

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

258261
```
259262
gh stack push [flags]
260263
```
261264

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.
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.
266+
267+
| Flag | Description |
268+
|------|-------------|
269+
| `--remote <name>` | Remote to push to (defaults to auto-detected remote) |
270+
271+
**Examples:**
272+
273+
```sh
274+
gh stack push
275+
gh stack push --remote upstream
276+
```
277+
278+
### `gh stack submit`
279+
280+
Push all branches and create/update PRs and the stack on GitHub.
281+
282+
```
283+
gh stack submit [flags]
284+
```
285+
286+
Creates a Stacked PR for every branch in the stack, pushing branches to remote if needed.
263287

264-
After creating PRs, `push` automatically creates a **Stack** on GitHub to link the PRs together. If the stack already exists on GitHub (e.g., from a previous push), it is left as-is — updating existing stacks will be supported in an upcoming release.
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.
265289

266290
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.
267291

268292
| Flag | Description |
269293
|------|-------------|
270294
| `--auto` | Use auto-generated PR titles without prompting |
271295
| `--draft` | Create new PRs as drafts |
272-
| `--skip-prs` | Push branches without creating or updating PRs |
273296
| `--remote <name>` | Remote to push to (defaults to auto-detected remote) |
274297

275298
**Examples:**
276299

277300
```sh
278-
gh stack push
279-
gh stack push --auto
280-
gh stack push --draft
281-
gh stack push --skip-prs
301+
gh stack submit
302+
gh stack submit --auto
303+
gh stack submit --draft
282304
```
283305

284306
### `gh stack view`
@@ -401,8 +423,8 @@ gh stack add auth-middleware
401423
gh stack add api-routes
402424
# ... write code, make commits ...
403425

404-
# 4. Push everything and create PRs
405-
gh stack push
426+
# 4. Push everything and create Stacked PRs
427+
gh stack submit
406428

407429
# 5. Reviewer requests changes on the first PR
408430
gh stack bottom
@@ -411,7 +433,7 @@ gh stack bottom
411433
# 6. Rebase the rest of the stack on top of your fix
412434
gh stack rebase
413435

414-
# 7. Push the updated stack
436+
# 7. Push the updated branches
415437
gh stack push
416438

417439
# 8. When the first PR is merged, sync the stack
@@ -452,7 +474,7 @@ gh stack add -Am "Frontend components"
452474
# → feat/02 already has commits, creates feat/03 and commits there
453475

454476
# 7. Push everything and create PRs
455-
gh stack push
477+
gh stack submit
456478
```
457479

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

cmd/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func runInit(cfg *config.Config, opts *initOptions) error {
351351
}
352352

353353
cfg.Printf("To add a new layer to your stack, run `%s`", cfg.ColorCyan("gh stack add"))
354-
cfg.Printf("When you're ready to push to GitHub and open a stack of PRs, run `%s`", cfg.ColorCyan("gh stack push"))
354+
cfg.Printf("When you're ready to push to GitHub and open a stack of PRs, run `%s`", cfg.ColorCyan("gh stack submit"))
355355

356356
return nil
357357
}

cmd/merge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func runMerge(cfg *config.Config, target string) error {
6969

7070
if br.PullRequest == nil {
7171
cfg.Errorf("no pull request found for branch %q", br.Branch)
72-
cfg.Printf(" Run %s to create PRs for this stack.", cfg.ColorCyan("gh stack push"))
72+
cfg.Printf(" Run %s to create PRs for this stack.", cfg.ColorCyan("gh stack submit"))
7373
return ErrSilent
7474
}
7575

cmd/merge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestMerge_NoPullRequest(t *testing.T) {
4343

4444
assert.ErrorIs(t, err, ErrSilent)
4545
assert.Contains(t, output, "no pull request found")
46-
assert.Contains(t, output, "gh stack push")
46+
assert.Contains(t, output, "gh stack submit")
4747
}
4848

4949
func TestMerge_AlreadyMerged(t *testing.T) {

0 commit comments

Comments
 (0)