Skip to content

Default to atomic git pushes - #596

Merged
skarim merged 3 commits into
mainfrom
skarim/push-atomic-default
Oct 26, 2026
Merged

skarim merged 3 commits into
mainfrom
skarim/push-atomic-default

Conversation

@skarim

@skarim skarim commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Defaults Stack CLI pushes to atomic updates so branch updates succeed or fail together.

Functionality and user impact

  • Atomic by default. push, submit, sync, and link push branches together; submit now uses one batch. PR/API updates are not atomic.
  • Explicit opt-out. Use --no-atomic or GH_STACK_NO_ATOMIC=1; --no-atomic=false overrides the environment. No automatic non-atomic retry.
  • Safe reordered submits. For pending modify changes, at-risk PRs temporarily target the trunk before pushing. Final bases are restored afterward; failures retain the existing recovery journal.

Key areas to review

Copilot AI max review requested due to automatic review settings October 26, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Submit’s changed ordering risks prematurely marking reordered PRs as merged and needs human validation of a recovery-safe approach.

2 open issues
What changed in this PR

Makes Git pushes atomic by default across gh-stack’s publishing commands, replacing opt-in atomicity with explicit opt-outs.

Changes:

  • Add --no-atomic and GH_STACK_NO_ATOMIC controls to push, submit, sync, and link.
  • Batch submit’s branch pushes before PR creation and updates.
  • Expand push-safety tests and document atomicity, override precedence, and recovery behavior.
File Description
skills/​gh-stack/​references/​commands.md Document atomic defaults, opt-outs, and submit ordering.
README.md Update command descriptions and flag tables.
internal/​git/​gitops_test.go Compare atomic and non-atomic behavior on lease rejection.
docs/​src/​content/​docs/​reference/​cli.md Document flags, environment precedence, and atomicity limits.
docs/​src/​content/​docs/​guides/​workflows.md Explain atomic pushes in the rebase workflow.
cmd/​sync.go Add atomic opt-outs while preserving force-push selection.
cmd/​sync_test.go Assert atomic pushes with and without rebasing.
cmd/​submit.go Push active branches together before processing PRs.
cmd/​submit_test.go Update batching, ordering, and pending-modify recovery coverage.
cmd/​push.go Enable atomic pushes by default with explicit opt-outs.
cmd/​push_test.go Cover defaults, override precedence, and no automatic downgrade.
cmd/​link.go Make existing atomic push behavior configurable.
cmd/​link_test.go Assert non-force, atomic branch pushes.

Review effort: Max

Comment thread cmd/submit.go
Comment thread cmd/push_test.go
@skarim
skarim force-pushed the skarim/push-atomic-default branch from 70d9279 to 8c313e8 Compare October 26, 2026 20:37
@skarim
skarim merged commit 2a49e67 into main Oct 26, 2026
15 checks passed
@skarim
skarim deleted the skarim/push-atomic-default branch October 26, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants