Skip to content

Commit b94bfa8

Browse files
committed
clarify push behavior
1 parent f9c9bbb commit b94bfa8

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Push all branches in the current stack to the remote.
355355
gh stack push [flags]
356356
```
357357

358-
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.
358+
Pushes every branch in one `git push` using explicit per-branch `--force-with-lease` checks. The update is not atomic: branches whose leases pass may update even if another branch is rejected. Fix the rejected branch and rerun the command; branches already updated will be unchanged. This command does not create or update pull requests — use `gh stack submit` for that.
359359

360360
| Flag | Description |
361361
|------|-------------|

cmd/push.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ func PushCmd(cfg *config.Config) *cobra.Command {
2222
Short: "Push all branches in the current stack to the remote",
2323
Long: `Push all branches in the current stack to the remote.
2424
25-
Uses --force-with-lease and --atomic to ensure safe, all-or-nothing pushes.
26-
Merged and queued branches are automatically skipped. This command is safe to
27-
run repeatedly — it will only update branches that have changed.`,
25+
Uses explicit per-branch --force-with-lease checks. Updates are not atomic: a
26+
branch may update even if another branch is rejected. Fix the rejected branch
27+
and run the command again; branches already updated will be unchanged.
28+
Merged and queued branches are automatically skipped.`,
2829
Example: ` # Push all stack branches to the default remote
2930
$ gh stack push
3031
@@ -77,7 +78,7 @@ func runPush(cfg *config.Config, opts *pushOptions) error {
7778
}
7879
s := stacks[0]
7980

80-
// Push all active branches atomically
81+
// Push all active branches with explicit per-branch leases.
8182
remote, err := pickRemote(cfg, currentBranch, opts.remote)
8283
if err != nil {
8384
if !errors.Is(err, errInterrupt) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ gh stack push
249249

250250
This is equivalent but distinct from updating your branch using a merge commit. The key difference is that after changing a lower branch, rebase maintains a linear commit history so the unique set of commits on each branch have clean diffs.
251251

252-
`gh stack push` then handles the force push safely via `--force-with-lease --atomic`, ensuring either all branches update or none do.
252+
`gh stack push` then handles the force push with explicit per-branch `--force-with-lease` checks. The multi-branch push is not atomic: branches whose leases pass may update even if another branch is rejected. Fix the rejected branch and rerun the command; branches already updated will be unchanged.
253253

254254
For a simpler all-in-one flow, `gh stack sync` combines fetch, rebase, and push into a single command — useful when you just need to pull in the latest upstream changes:
255255

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ gh stack push [flags]
408408
|------|-------------|
409409
| `--remote <name>` | Remote to push to (defaults to auto-detected remote) |
410410

411-
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.
411+
Pushes every branch in one `git push` using explicit per-branch `--force-with-lease` checks. The update is not atomic: branches whose leases pass may update even if another branch is rejected. Fix the rejected branch and rerun the command; branches already updated will be unchanged. This command does not create or update pull requests — use `gh stack submit` for that.
412412

413413
**Examples:**
414414

skills/gh-stack/SKILL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ gh stack push --remote upstream
512512

513513
**Behavior:**
514514

515-
- Pushes all active (non-merged) branches atomically (`--force-with-lease --atomic`)
515+
- Pushes all active (non-merged, non-queued) branches in one non-atomic multi-ref push with explicit per-branch `--force-with-lease` checks
516+
- Some branches may update if another is rejected; fix the rejected branch and rerun the command
516517
- Does **not** create or update pull requests — use `gh stack submit` for that
517518

518519
**Output (stderr):**
@@ -541,7 +542,7 @@ gh stack submit --auto --open
541542

542543
**Behavior:**
543544

544-
- Pushes all active (non-merged) branches atomically (`--force-with-lease --atomic`)
545+
- Pushes each active (non-merged, non-queued) branch sequentially with explicit per-branch `--force-with-lease` checks; the overall submit is not atomic
545546
- Creates a new PR for each branch that doesn't have one (base set to the first non-merged ancestor branch)
546547
- After creating PRs, links them together as a **Stack** on GitHub (requires the repository to have stacks enabled)
547548
- If every PR in the stack has already been merged, the stack is complete and can't be extended. `submit` automatically forks your unmerged branches into a **new** stack rooted at the trunk and creates it on GitHub, leaving the merged stack untouched.

0 commit comments

Comments
 (0)