Repository navigation
Conversation
Pushing each branch separately makes GitHub sync every stacked PR twice (once for its base push, once for its head push), in no fixed order. Push all active branches together so the server can sync each PR once, and so the remote never holds a partially-updated stack. Branches are still pushed one at a time when a modify is pending, since PR bases may be stale until each PR is retargeted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Warning
Authored with Copilot. Please review very closely with high skepticism 😅
Relates to https://github.com/github/pull-requests/issues/26195
Description
When rebasing and submitting a stack, pushing each branch in isolation causes GitHub to trigger two synchronization jobs for each downstream PR in the stack (one for the base push and one for the head push). Because these sync jobs run asynchronously in no guaranteed order, approvals can be dismissed inconsistently or attributed to different commits.
This change updates
gh stack submitto push all active branches together in a single atomic push (with per-branch--force-with-leasechecks), matching howgh stack syncpushes rebased stacks.Note: When a
gh stack modifyis pending, sequential per-branch pushes are preserved so PR base branches can be updated between pushes to avoid comparing against outdated bases.Changes
cmd/submit.go: Push all active branches in a single atomic push before creating/updating PRs (falling back to sequential pushes only if a modify is pending).cmd/submit_test.go: Update tests to assert atomic batch push and addedTestSubmit_AtomicPushFailureCreatesNoPRs.docs/src/content/docs/reference/cli.md: Document atomic push behavior in submit documentation.How did you test this change?
Ran full test suite (
go test ./...) across all packages.