r/programming • u/tomzorzhu • Jul 30 '26
Stacked pull requests are now in public preview - GitHub Changelog
https://github.blog/changelog/2026-07-30-stacked-pull-requests-are-now-in-public-preview/
591
Upvotes
102
u/koreth Jul 30 '26 edited Jul 31 '26
My team got access to this a few weeks ago during the closed beta. We've been doing stacked PRs for a long time, most recently using Graphite, so we're well-versed in the stacked PR workflow.
GitHub's stack support still feels very rough to me, which is surprising given GitHub/Microsoft's engineering resources and how long they've been working on it. Graphite is a much more polished, feature-rich product even though it has to sit on top of GitHub comments and an external service.
For example, with Graphite, it's trivial to decide that your stack's latest change doesn't actually depend on the rest of the stack and can be standalone; you just move it off the stack with a single command and it becomes an independent change. With GitHub stacks, the only way I can see to do that is to delete the stack, move the git branches around with
git rebase -ior whatever, then create the stack again.I also don't love how GitHub stacks have a server-side source of truth (or at least that's my guess about why it acts the way it does). I'm used to being able to iterate on my stack completely locally and only start publishing it when I think it's ready for review. Graphite works that way. But as soon as you create a GitHub stack, it seems to want to push your branches to GitHub for everyone to see, whether you want that or not.
And just generally, it seems like a lot of the time I try something new with
gh stack, it works in a way I didn't expect and I have to figure out how, or if, I can get the behavior I actually wanted. Granted, some of that is probably that I'm used to an existing tool. But some of it suggests to me that the people working on the tool have a very different stacking workflow than I do. For example, PRs are created as drafts unless you explicitly pass in an option to create them as regular, open PRs. That's backwards from pretty much every other GitHub-integrated tool I've ever used.My team has been giving feedback on some of the things we've run into, but so far, there's no indication that anyone working on the feature has even looked at our feedback, much less acted on it.
Stacking as a concept is something I find very useful, so despite my largely negative review, I'm actually rooting for GitHub to get it right so we don't have to rely on third-party tools. But for now, I think they're behind the competition.
19
u/ImpactfulBird Jul 31 '26
Imagine reinventing the wheel after 10+ years of Gerrit availability, and still do not support basic
git rebasewith it. Still a single PR with 2+ commits is non-trackable, thus non-reviewable, if commits are operated with rebase / fixup.20
u/teknikly-correct Jul 31 '26
LGTM
139
u/BCMM Jul 30 '26
I still don't really understand this. I ask this genuinely wanting to know what I'm missing: isn't that what commits are for?
If people aren't using the commits in a pull request like this, what are they using them for? I thought git was pretty much designed around rewriting history, so that the final commits represent semantically-meaningful changes to the codebase, rather than a step-by-step log of how the developer wrote those changes.
Are people sending PRs that simply contain all of their local "whoops, typo" commits? Are they just squashing the whole PR in to one big commit?
109
u/thelehmanlip Jul 30 '26
Whats better than reviewing one PR than reviewing one PR that's 10 PRs?
9
u/Goodie__ Jul 30 '26
Does anyone have a public stacked pull request I can look at to try and get an idea of what this actually looks like? They mention you can make a stacked PR from the UI.... but then never show it.
Honestly feels like vendor lock in.
16
u/wallstop-dev Jul 30 '26
That's great, I suppose, a lot of people really like this, and systems like jujutsu are built around it (I think?)
Every time I have encountered this in the wild, it has never been good. The reason for that is that stacked PRs put the cart before the horse. They assume that their base PR, and every following PR, are great and perfect and just need to be merged.
Maybe people work in different teams and fields than me, but almost always I have large amounts of PR feedback. That feedback then changes the course of the rest of the PRs.
So why have them at all? Just make the first PR. Get it approved. Make the second PR.
If you have all the changes locally and want to stagger them, great, they're commits, just manipulate history.
Perhaps I'm just old and yelling at clouds.
2
u/fanz0 Jul 31 '26
How is this different from creating multiple PRs linked to an issue?
2
u/DigThatData Jul 31 '26
this is a process, not a product. you just do it.
this is basically just "intermediate branch with a fancy name"
2
u/pepejovi Jul 31 '26
To be fair, I've never used this feature, but why is this superior to others?
e.g. Gerrit (because that's what I have experience with)
Gerrit has one commit, one change, one change request. If you push N commits, for N changes, you get N change requests, chained together in the same order as the commits. Each change request is reviewed and approved separately, and the chain can be merged all together or up to a specific approved commit in the middle of the chain.
This seems to be the exact same, except instead of commits, it's PRs, and thus you can stuff >1 commit per MR into the chain? So if I want to use this new system "nicely" - i.e. separate concerns, small atomic changes, no unrelated changes in the PRs, keeping intent easy to understand - I still only want *one* commit per MR? What is the benefit of having multiple commits in a PR within a PR stack?
21
u/EnUnLugarDeLaMancha Jul 30 '26
After almost two decades, the "modern" development platforms are starting to catch up with email lists...
As someone who deals with gitlab at work, I have disliked these platforms from day one. They encourage the worst possible way of developing and reviewing code. Of course, they had to give in to better practices eventually, even if it only took 18 years...
4
u/thy_bucket_for_thee Jul 31 '26
I still honestly feel like stacked PRs are a technical solution to a social problem (how to organize work effectively). Most of big tech solutions often feel like they're accounting for overly toxic work flows.
I can see the utility for stacks but why does work need to be constrained into separate branches for a single individual? Mostly due to other people/services relying on said work, because of this it feels like an organizational issue. A solution I don't know, but I doubt a technological solution is the only one.
We aren't the only industry that has tasks dependent on other tasks after all.
1
u/unnanego Jul 31 '26
When is this coming to Enterprise Server?
1
u/wannaliveonmars Jul 31 '26
Sounds interesting, but at the same time isn't that what commits are for? You make one PR with several commits, reviewers inspect the commits, then merge everything at once?
1
u/AsyncBanana Aug 01 '26
One of the few non-AI related new GitHub features.
1
u/XDPierre Aug 18 '26
They should've done Stacked PRs across repos... but instead they just crammed everything into the same one. The real fix is just branching correctly - you don't even need Stacked PRs for that. If anything, stacking just increases the amount of code review needed to get something approved. Before, you needed 2 people to review a PR. Now we need 10 people reviewing the same set of changes across the stack lol. Basically it takes longer, and nobody really knows what the others changed without going through the whole stack. Which means those 10 reviewers will, in theory, need to see the entire stack anyway. Isn't that just... slower?
1
u/kampak212 Aug 19 '26
this killed a merge stack or something project, I believe, and the single best feature the team shipped this year
1
u/Upbeat_Rope1614 Sep 29 '26
This is the worst thing ever...
1
u/wanderer_2110 Oct 24 '26
Stacking fixes size, but not order. Even in a stack, each PR is read in whatever order GitHub lists the files. The review habit that matters is the same either way: contracts first, then the core change, then callers, then tests. Stacked PRs make that easier because each layer is its own PR, but a lot of changes (a refactor, a dependency bump) don't split cleanly, and you're back to one large diff.
The thing to watch is rebasing. If the base PR gets amended, the reviews on the PRs above it can go stale without anyone noticing. Whatever tool you use, make sure it tells you what changed since your last review.
1
u/putergud Jul 31 '26
I must have missed when stacked PRs stopped being a code smell.
1
u/wildjokers Jul 31 '26
Kind of crazy that branches of branches are so hard to merge in git that it requires tons of tooling. git is fine with this until one of the ancestor branches is squash merged and its ancestry effectively disappears. Then all hell breaks loose.
Meanwhile, 10-15 years ago I was creating branches of branches of branches in subversion and never had a problem merging them all, as long as you kept in mind the SVN-898 rename bug, which only took 14 years to fix.
0
u/jonnii Jul 31 '26
I'm really excited for this to be broadly available, I believe stacked PRs are a super power for engineers and the teams that adopt them. While you absolutely can stack commits if github is the forge you use it's more ergonomic, in my experience, to use the PR as a unit of review.
Personally I like stacked PRs because it means I'm rarely blocked on making progress because of PR review and I don't end up feeling like I need to stuff more changes into a single change.
Previously I have used graphite (which is great but paid) and git-spice (which is also great and open) but recently have built my own tool (https://github.com/getstackit/stackit) because the open source tools didn't quite work the way I wanted. At the end of the day a first party experience will beat any third party tool but if you're new to stacking just know there are plenty of other options out there.
-4
u/powdertaker Jul 30 '26
So they've re-invented the commit. Awesome. Now that's modern! /s
-1
u/ineedanaccountlol134 Jul 30 '26
Great idea but it's a buggy mess
-1
u/ZukowskiHardware Jul 30 '26
If it isn’t going to prod in one small piece then the alternative of stacking , rebasing, ordering , feature branching is all just a huge risk. CI/CD is trivial these days. There is no excuse.