Stacked pull requests are now in public preview 🚀 #201439
Replies: 379 comments 223 replies
|
gh extension install github/gh-stack |
|
My claude code workflow would love if the CLI allowed merging stacks as well. Further, when the stack requires a rebase, the "merge" button is still green and seems to attempt a merge that will inevitably fail, this is rather frustrating as it takes quite some time for the UI to reflect this |
|
Please show the PR approvals on the stack list and merge stack list! |
|
Idk if I did something wrong, but I did merge PR2 and then PR1 and only got PR1 merged to main. I had to merge main into PR2 and solve conflicts to be able to merge that one as well. In any case, I think it's not very intuitive what's going on; this was my structure:
|
|
Thanks for the 🥞! |
|
Can I unstack them so that I can merge things? Right now I have a PR to Branch A and cannot merge it because the PR from Branch A to Develop is blocking it, seems kind of dumb. |
|
A share button that copies the links to each PR in the stack so I can share with my colleagues when asking them to review |
|
It would be great if you made it so these new stack commands worked via github PATs - otherwise it will be a little dangerous with agents (you have to give them full access). |
|
this feature looks really promising, but I think it only becomes useful when a contributor who doesn't have access to the repo can stack PR submissions. unless I'm missing something, all branches must be in the same repo currently. They aren't when you submit a PR to another repo, and you might want to stack onto your first PR |
|
I have a use case for this that would be greatly improved with a pretty minor change. Occasionally, I need to make a change that should be deployed in multiple separate steps. For example, removing an S3 bucket from a Terraform deployment - first I need to merge a change to enable force-destroy and apply that (so it can be removed without emptying its contents first), then I need to merge a second change to actually remove it. Stacked PRs look like a great way to create both PRs ahead of time and mark them as related for reviewers, but I don't see any way for the stack creator to force the individual PRs to be merged separately. In the case I described above, someone merging both of them at once defeats the purpose and causes a failed apply. If I could disable merging multiple PRs at once for a specific stack, it would be much more useful and safer for this use case. |
|
I lowkey dislike the github stacks feature they added |
|
EDIT: Seems there is a phased rollout, as we now have support! This feature is not currently working for any repo in our organization that has a Merge Queue. Is there any guidance of how to enable this? I verified this to see 404 vs. 200 statuses for the stack feature against all of our repos. |
|
Would be nice to be able to mark a whole stack as "ready for review" at once |
|
All commits before the stack are suddenly unverified even though no changes were made to my local signing ability, any commits pushed up after stacking are verified as usual |
|
Copilot |
|
Copilot |
|
In case you're looking for "dumb things people can do to mess up their stacks", here's one thing I did: My setup is that I have two separate directories where my git repos are. When an agent is working in directory 1, I'll make changes in directory 2 in another branch. (I know now that I should be using work trees for this but oh well) Then, I did these steps:
After I ran this, a bunch of PRs in the stack had a ghost "merge" happen--it said they had merged into the main branch in GitHub but the commits weren't on main. This was on my company account so I can't link here, I'll see if I can replicate it on this account and update later to link to this |
|
Maintaining a stack of PRs is impossible on our fast moving What we'd rather have, is an ability to treat it more like a feature branch, where individual branches are merged into the feature branch, nicely visualized with the PR UI as a graph, rather than a stack. |
|
This may not be "fixable" Due to |
SummaryClicking Enqueue stack on a stack where two or more PRs merge in the same Steps to reproduceEnvironment
ExpectedC is retargeted to the first surviving ancestor (here ActualC is retargeted onto A's head branch, which the same batch deletes. C is closed EvidencePRs #19465 and #19467 merged in the same second, one batch: Timeline for #19477 (the next PR up), from
Two details rule out "working as intended": ImpactThe PR is closed, not just blocked, so review history and approvals are Aggravating factors during recovery
Suggested fixResolve the auto-retarget to the nearest ancestor that will still exist after WorkaroundEnqueue the bottom PR alone, wait for the merge and retarget to settle, then |
|
I think it'd be pretty normal to want to drop a PR from a stack. And that seems to be supported EXCEPT on the last PR on the stack? I can understand not wanting to try and support a strange rebase directly, but even on the case where I have merged the bottom N, and the final piece of the stack is unmerged? If I do a |
|
It appears that the "Merge when ready" option with merge queues is currently missing for stacks. Is that a bug, or is it just a roadmap item not yet implemented? |
|
+1 for cross-fork stack support. My use case: I maintain a downstream fork and regularly send changes to the upstream repository. Since all branches in a stack must live in the same repository, the entire feature is unavailable for the standard fork-based contribution flow — which is how most open-source contributions (and downstream fork setups) work. On the rebase side: I understand rebasing necessarily rewrites commit SHAs, and the automatic restack on merge is genuinely nice. Given that trade-off is inherent to the design, fork support feels like the bigger gap — without it, external contributors cannot use stacks at all, while same-repo teams already get the full workflow. Is cross-fork support planned for GA? |
Good ProblemStacks touch on a real issue: Merging from the "bottom" of the stack is the safest / most incremental way to introduce change, but places a big burden on the developer to sync everything up the stack once merged. You need to be pretty familiar with
The ImplementationI solely use the The (AI) skills used to create a stack seem to work well, but manually creating a stack ( The underlying resource we are working with here is still a "Pull Request". I think this concept should be seamlessly integrated into the existing Pull Request experience, rather than exposing this as a new/separate feature to the end user. The web UI feels pretty good, but the CLI experience is funky — and I imagine it's related to the way it was built, and that complexity is being exposed here (is a "stack" a new entity type?). ClosingGitHub invented the "Pull Request". A new, distinct name is great for giving everyone a label to talk about a new concept, but I think the concept can be more seamlessly integrated. We already have: gh pr create --base some-feature-branchI think a better experience would be as simple as an additional flag here: gh pr create --stackImagine: # Create a PR "synced" to its base
gh pr create --sync
# Open TUI to reorder "synced" PR's
gh pr reorder
# Stop syncing a PR
gh pr unsync 1234
# Merging a PR (existing workflow) rebases everything up the "stack" for anything "synced"
# This would be helpful for parallelized work where multiple features are dependent on a base body of work.
gh pr merge |
|
Currently for stack PR's for each PR , we have to set reviewer , can we allow setting a reviewer for a complete stack at once ? Will be a good addition what i feel. |
|
Stack PR stack cannot be merged. GitHub shows it is merging individual PRs, then it resets and merges the first PR indefinitely. No logs anywhere. This experience is so frustrating. |
|
Two merge problems from a real 11 PR stack, one of which looks like a straightforward bug. 1. The web merge button hangs forever because it does not call the endpoint that worksClicking Merge on a stacked PR spins on "Merging…" indefinitely with no error and no state change. The PR was The reason shows up the moment you leave the UI: Only So the endpoint exists and is fast. The UI just is not using it, and it fails silently instead of surfacing the same message the API returns immediately. Showing that error would have saved a lot of guessing. 2. Merging the bottom PR invalidates every approval above itAfter the bottom PR merged, GitHub retargeted and auto-rebased the rest of the stack. That part worked correctly. But every head SHA above it changed, so every approval went stale at once. Nine PRs, nine approvals gone in one merge, and the same thing would happen again on the next one. For a stack of any size that makes incremental merging impractical: you collect N approvals, merge one, then re-collect N-1, and so on. We gave up and collapsed the remaining ten PRs into a single branch off the default branch. If the intended model is "merge the whole stack in one operation" then that is workable, but the per-PR merge button probably should not be offered in that case, and the approval churn is worth documenting. Related: Repo settings in case they matter: squash disabled, merge commits allowed, |
|
This is a useful feature that I'm trying to integrate into my workflow, but I've run into confusion a couple of times now so I figure it's time to offer feedback. There's a button that says "Rebase stack" that appears on pull requests. Great. I understand what this does. I click it, and all of my branches (on the remote) get rebased. Now that I've done that, my local is out of sync. I've tried several different ways to get local back in sync with the remote, and the least destructive way seems to be the most tedious because there isn't a single
|
|
Title: Atomic stack merge is blocked by the base branch's "Require a pull request before merging" rule — the finale is a TL;DR: On a branch protected by a repository ruleset whose Environment
Reproduction
ExpectedThe stack merges, or the failure names the layer/requirement that is not satisfied. ActualThe atomic rollback itself works correctly — the base branch is untouched and no PR is modified (verified: bases and approvals unchanged after each attempt). 👍 Evidence that the failing step is not any of the layers1. The web UI's rule-evaluation detail names a separate final step: So the ruleset passed for the stack's PRs, and something after that failed with the approval message. 2. The rule-suite API agrees. 3. The merge-async payload says the finale is a direct merge: {"status":"pending","details":{"message":"Merge request is in progress.",
"uuid":"<uuid>","merge_method":"squash","merge_action":"direct_merge",
"expected_head_sha":"<top head sha>"}}… and terminally: {"status":"failed","details":{"message":"Repository rule violations found\n\nAt least 1 approving review is required by reviewers with write access.\n\n"}}Control experiment (this is the part that isolates it)In a third repo of the same org whose Things ruled out (each verified, none is the cause)
HypothesisThe atomic stack merge evaluates each layer as a pull-request merge (all pass), then performs a single ref update on the base branch ( I can't see the server side, so this is an inference from the three observations above; the observations themselves are reproducible. ImpactAny repository whose trunk requires a pull request — i.e. the normal setup that stacked PRs are meant for — cannot use atomic stack merge against that trunk. Two independent repos, four attempts, identical failure. The error text also actively misleads: it names a missing approval when every PR has one from a write-access reviewer. It cost us a full round of re-requested reviews from a human reviewer before we found the "Final merge failed" line, which is only visible in the web UI's rule-evaluation detail page — the CLI does not surface it. Workaround (works today)Land the stack on an intermediate branch that has no rules, then merge that branch into the trunk with an ordinary PR:
Cost: one extra hop, one extra approval, and the bottom PR's base change risks dismissing its approval. Suggestions
Relationship to existing reportsDifferent from the ones I found, though possibly the same subsystem:
If maintainers think these are one root cause, happy to have this folded in — the Secondary observations (separate from the above; can file separately if useful)
|





Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Stacked pull requests break large changes into small, reviewable pull requests. They're an ordered series of pull requests that each represent focused layers of your change. With stacks, you can independently review and check each pull request, then merge everything together in one click. No more opening a single large pull request that takes forever to review, or splitting work across multiple branches you have to keep manually rebasing.
072926-gitub-tmp-pr-v08.mp4
With stacked pull requests, teams can:
main.And because stacked pull requests are built into GitHub, your existing reviews, checks, and merge requirements all work out of the box.
Get started with the CLI extension
Install the CLI extension and create your first stack in under a minute:
Create stacks from your terminal or github.com
Create a stack from github.com, the GitHub CLI, the GitHub mobile app, or with a coding agent such as GitHub Copilot using the gh-stack skill. Start with a branch and pull request for your first change. Then add branches and pull requests on top of it; each pull request targets the layer below it.
Stacks-Changelog-InLine-01-CLI.mp4
Review each layer independently
Open any pull request in the stack to review only the diff for that specific layer. Use the stack map at the top of the pull request to see how the change you're reviewing fits into the larger work. You and your teammates can each review different layers in parallel without blocking further work.
Merge everything in a single click
Merge the latest ready pull request to land it and every unmerged layer below it in one single operation. To land part of a stack, merge one or more lower layers—the pull requests above it stay open and automatically rebase and retarget. Your existing branch protections and required checks still govern what reaches
main.Stacks-Changelog-InLine-03-MergeBox.mp4
Find out more and share your feedback
Stacked pull requests are rolling out in public preview to all repositories over the coming days. Merge queue support for stacked pull requests is rolling out progressively over the coming weeks.
For more information, check out the stacked pull requests documentation, and share your feedback with us in the comments below!
All reactions