Skip to content

feat: batch push branches#125

Merged
boneskull merged 8 commits into
mainfrom
push-many
May 26, 2026
Merged

feat: batch push branches#125
boneskull merged 8 commits into
mainfrom
push-many

Conversation

@boneskull
Copy link
Copy Markdown
Owner

This changes the behavior of gh stack submit so that it pushes all branches at once, atomically.

This improves performance.

This changes the behavior of `gh stack submit` so that it pushes all branches at once, atomically.

This improves performance.
Copilot AI review requested due to automatic review settings May 26, 2026 02:43
@boneskull
Copy link
Copy Markdown
Owner Author

📚 Pull Request Stack


Managed by gh-stack

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates gh stack submit to batch-push all affected branches in a single git push invocation using --atomic (alongside --force-with-lease), improving performance and making multi-ref updates all-or-nothing.

Changes:

  • Add Git.PushMany() and route Git.Push() through it.
  • Change submit “Phase 2: Push” to collect branches and push them in one atomic operation.
  • Add unit/e2e coverage for multi-branch push behavior and update documentation to describe the new atomic push semantics.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
README.md Documents the new atomic batch push behavior for gh stack submit.
internal/git/git.go Introduces PushMany and reuses it for single-branch pushes.
internal/git/git_test.go Adds unit tests and helpers around multi-branch push + atomic behavior.
cmd/submit.go Switches submit push phase from per-branch pushes to one batched atomic push.
e2e/submit_test.go Adds an end-to-end test asserting batched/atomic push behavior and output.
AGENTS.md Notes that CHANGELOG.md is generated and should not be manually edited.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/git/git.go Outdated
Comment thread internal/git/git.go Outdated
Comment thread cmd/submit.go Outdated
Comment thread cmd/submit.go Outdated
Comment thread internal/git/git_test.go Outdated
Comment thread internal/git/git_test.go Outdated
Comment thread internal/git/git_test.go Outdated
boneskull added 7 commits May 25, 2026 19:50
The Push doc comment said "force-pushes ... with lease" but the function
takes a `force` flag and only adds `--force-with-lease` when true. Update
the comment to describe both branches honestly.

Per PR #125 review.
Insert a `--` end-of-options marker between the flag list and the refspec
list so a branch starting with `-` is never parsed as a git option.

Per PR #125 review.
Other submit output ("Skipping push for ...") formats branch names via
`s.Branch(...)`; the batched push summary should do the same so colors and
emphasis stay consistent across the phase.

Per PR #125 review.
The previous `push failed: %w` wrapping dropped the list of branches being
pushed, making failures harder to diagnose at a glance. Include the
branch names alongside git's underlying error.

Per PR #125 review.
Helper returns four values (localDir, remoteDir, *Git, trunk) but the
comment only listed three. Sync the comment with the signature.

Per PR #125 review.
The first block wrote a file into the bare remote and ran `update-ref ...
HEAD` with all errors ignored. It did nothing useful — the temp-clone push
that follows is what actually creates the divergence — and was confusing.
Remove it and tighten the remaining setup so errors are surfaced via
`t.Fatalf` instead of being swallowed.

Per PR #125 review.
The previous check (`remoteB != tipBNew`) could pass for the wrong reason —
e.g. `rev-parse` returning `""` on error would silently satisfy it. Use
the captured pre-push tip (`tipBLocal`) for an exact equality check, and
fail loudly if the remote SHA can't be read at all.

Per PR #125 review.
@boneskull boneskull merged commit 2250f2b into main May 26, 2026
7 checks passed
@boneskull boneskull deleted the push-many branch May 26, 2026 02:54
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.

2 participants