Conversation
This changes the behavior of `gh stack submit` so that it pushes all branches at once, atomically. This improves performance.
Owner
Author
📚 Pull Request Stack
Managed by gh-stack |
Contributor
There was a problem hiding this comment.
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 routeGit.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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the behavior of
gh stack submitso that it pushes all branches at once, atomically.This improves performance.