Top
Best
New

Posted by tomzorz 4 hours ago

Stacked PRs are now live on GitHub(github.blog)
254 points | 96 comments
matharmin 2 hours ago|
I've been using the preview for a bit, and I'm quite surprised to see them expanding the preview with so many unfixed issue.

For example, merging an entire stack is completely broken in many cases: https://github.com/github/gh-stack/discussions/212

You can merge one by one, but if you're using squash and merge, you need a re-approval for each PR in the stack if you require reviews. This makes you lose out on arguably the biggest gain of stacked PRs.

The command line tooling (gh stack) helps to make things slightly less manual, but you still need to be very aware of how git rebase works, the tooling just helps automate it across multiple branches. For example, just running the "gh stack rebase" commands that the UI suggests won't work if your local branches are not in sync with the remote ones, and the tooling won't point that out to you.

I do find the stack UI quite nice. It's quite minimal compared to standalone PRs, but it's enough to show the relationship between them.

(My comments all assume you already have a good reason to stack PRs. This tooling just help to make the workflow easier, it does not give any new capabilities)

sameenkarim 1 hour ago||
We're rolling out a series of bug fixes for the issues with squash merging.

There's an internal system we have called CPRMC (Create Pull Request Merge Commit) that is used to evaluate whether a PR is "ready" to merge. This covers everything from mergeability (checking for merge conflicts) to rule evaluations (ensuring that approvals match the potential commit that will be created by merge) and more.

This becomes particularly difficult when squash merging a stack of multiple PRs because we have to calculate a series of squashed commits, then associate those back to the rules/reviews. This is relatively easy for the first PR, but for the second PR onwards this gets more complicated because the ancestor commits are squashed and don't exist on the branch as-is. And I won't get into how much more complicated it gets for multi-parent situations lol.

It's something we need to fix and it's the top priority for the team. Our numbers show that 99% of stack merges go through successfully, but we need to get that much higher.

Thank you for being an early user in the preview and bearing with us while we work out these issues!

masklinn 51 minutes ago||
> There's an internal system we have called CPRMC (Create Pull Request Merge Commit) that is used to evaluate whether a PR is "ready" to merge. This covers everything from mergeability (checking for merge conflicts) to rule evaluations (ensuring that approvals match the potential commit that will be created by merge) and more.

By the way could there be a way to disable that when doing integrations externally? It seems to be quite costly (which makes sense), and the pull/ refs kinda bloat the reflist.

I’m sure that external integration is not exactly beloved internally but there’s really just a small handful of big annoyances which would make it so much nicer and more comfortable.

selimthegrim 1 hour ago|||
what if you stack a draft PR on top of a regular one?
ransom1538 42 minutes ago||
If you thought git was complex, wait until you get your 5 deep stacked PR from that nice coworker! Jokes aside this is really an anti-feature. Now coworkers can blow off your PR for much longer.
sameenkarim 1 hour ago||
Hey from the GitHub Stacked PRs team!

Excited to release this more broadly so anyone can start stacking: https://gh.io/stacks

Would love to hear any feedback, especially with the UI and CLI. We've got a lot more updates to the PR experience in store!

Also happy to answer questions about the design decisions we made. There's a bunch happening behind the scenes, and it's one of the largest launches in GitHub history covering almost every service from Actions and protection rules to the CLI and mobile apps.

joenot443 12 minutes ago||
Your team did an awesome job - I’ve been wanting this feature for years and what you guys delivered is exactly what I had in mind.
lobofta 8 minutes ago|||
I needed this feature! Thank you
leo60228 1 hour ago|||
Is support for cross-fork stacked PRs coming in the near future? I was surprised that didn't come before the feature entered public preview, as it seems rather important for the feature to be useful on public repositories.
RyJones 32 minutes ago||
This is the feature I’ve missed most from Gerrit. Thank you
steveklabnik 1 hour ago||
This is one of the biggest changes to hit GitHub in many years. I'm really glad to see something like this deployed to one of the largest forges in the world, hopefully it will expose a lot of developers to workflows that they didn't even know about before.

If you buy the idea that stacking produces better software, then this also has the opportunity to really help out quite a few people.

Okkef 2 hours ago||
What's the benefit of this type of stacked PRs over a well-curated set of commits, and reviewing per commit?

I think the bigger problem is that big AI PR's need a different way of reviewing. For example, the order in which the diff's are shown can make a big difference in how easy the commits are to read (e.g., function definition change first, then all call sites, then the tests).

Or maybe we should go to a system where diffs & comments are intertwined, a bit like how "Literate Programming" intertwines code and prose.

Literate diffs / literate pull requests... I haven't found anything like that yet.

dastbe 2 hours ago||
> What's the benefit of this type of stacked PRs over a well-curated set of commits, and reviewing per commit?

For the people who work with stacked diffs (in phab/otherwise) this is exactly what they'd consider reviewing a well-curated set of commits one-by-one.

One distinction is that cognitively a unit of review (a PR, a diff) remains a single bound change. Comments are focused on that change and the PR does not grow with size of the feature

Another distinction is the ability to focus each part of the stack to a particular audience. One change may require review from an external team, another may be just your team mate, a third might be the consuming team. By focusing the stack to the different reviewers you can avoid ambiguity about "what a person is signing off on" in the stack.

aside: one thing that would be great for github reviews is the adoption of change ids such that comments persist across reviews with a rebase workflow.

skydhash 1 hour ago||
IMO, in a team settings, improving the review policies and speed has a much better benefit. A PR is supposed to be a proposal for some change, adding more proposals on top of something that is not reviewed is a bit icky.

> . By focusing the stack to the different reviewers you can avoid ambiguity about "what a person is signing off on" in the stack.

That can be easily done with comments. If the PR are orthogonal, they could have been split. And if they're not, I would really like to know how the part that I'm reviewing interacts with the rest of the changes.

dastbe 1 hour ago|||
> That can be easily done with comments. If the PR are orthogonal, they could have been split.

Comments are ad-hoc and don't scale, relying on the author to interpret and adhere to the extent of the reviewers approval.

> And if they're not, I would really like to know how the part that I'm reviewing interacts with the rest of the changes.

you are free to look up, down, and around the stack; nobody is hiding the code from you. But in many cases this is just unnecessary.

a_t48 1 hour ago|||
The PRs may be orthogonal but still be dependent. Feature X depends on improvement Y which also needs bugfix Z. You might go and implement X in a branch, tweaking the codebase as you go, but split the branch apart for review. You put X/Y/Z up, but X contains Y and Z, which means you can't request reviews for X without Y and Z merging, or else have a bunch of extra code that gets in the way.
skydhash 1 hour ago||
Let's say that Z has an error (some assumption that does not hold), and needed to be reverted. How does that impact X's viability? I wouldn't trust any reviews of X after that.

I strongly believe that PR should be compared to the main branch, and not rely on unmerged code. Unless you merge everything together in one go. And in the latter case, everything should be reviewed together.

a_t48 1 hour ago||
I think the answer is - it depends! This is why we make good money. I don’t think there’s a hard and fast rule here to apply.
dualvariable 1 hour ago|||
> What's the benefit of this type of stacked PRs over a well-curated set of commits, and reviewing per commit?

What I can see is that you can easily append commits to e.g. the first PR in a stack, which would insert them into the middle of sequence of commits.

This will require rebasing and fixing the subsequent PRs in a stack the same way you'd need to rebase and fix the subsequent commits in a mega-PR. But it makes the right thing easy (keeping all the commits to the foundation of the change together) rather than makin the wrong thing easy (appending fixup commits across the entire change in a random order so that the actual foundational change is lost).

Keeping all the foundational commits together also keeps all the discussion over the foundational change together.

You could argue that you'd want to only do the foundational PR and stop, but doing the whole stack of PRs gives the reviewers more information about where you're going, and allows work to continue asynchronously.

Cedricgc 2 hours ago|||
With stacking you can continue working on a longer change while creating reviewable diffs. Merged diffs can be rebased on your HEAD. For teams that support stacked diffs you don't usually even need to manage branches and work directly off trunk and rebase changes as they come in
teeray 1 hour ago|||
It’s the “well-curated” part. Many folks treat commits like video game save points, and find providing any kind of message burdensome (e.g. “fix bug”, “do work”). This alone is fine, but then they can’t be bothered to go back and clean it up with `git rebase -i`, so you end up with a mountain of trash in your git log if you don’t turn on mandatory squash and merge. For these folks, the PR becomes the commit. Stacked PRs is revolutionary because it’s as though these developers can finally have multiple commits which comprise a change.
paxys 43 minutes ago|||
You can’t merge one commit at a time in a PR. In a stack, if the first 4 parts of a feature are good to go and there’s a problem with the 5th, the whole thing doesn’t need to be blocked.
mmlb 2 hours ago|||
I've had that same "what's the point" thought every time I've read about stacked PRs, but recently had an (obvious) epiphany. The benefit is you get CI for each commit! I've always hated fixup/typo/fix tests commits and toyed with having a CI check that enforced ci passing on each commit but this drops that need.
satvikpendem 1 hour ago|||
I don't get it, we already have CI for each commit, at least at our workplace, enforced.
skydhash 1 hour ago|||
> I've always hated fixup/typo/fix tests commits and toyed with having a CI check that enforced ci passing on each commit but this drops that need.

Can't you run your CI locally? I know it's not feasible for some codebase, but at least the linting, formatting, unit tests, some integration tests should be able to be done locally.

steveklabnik 1 hour ago||
You can't have mac/windows/linux/whatever all locally simultanously.

Not every project requires this, but for those that do, it's impossible.

Also, it is much harder to enforce "everyone must run each commit through the CI equivalent properly" than it is when it's on your forge.

skydhash 1 hour ago||
> You can't have mac/windows/linux/whatever all locally simultanously.

Why can't you? That's what VMs are for. And even then, most cross-platform codebases have an abstraction layer that rarely changes. So even testing on one platform can raise your confidence very high.

> Also, it is much harder to enforce "everyone must run each commit through the CI equivalent properly"

Again why? I wouldn't care about the dev's local branch. But what is send to the main repo can be easily scripted to run the CI on every commit. You just send the result back with each commit that fails. They can replicate the same workflow on their local workspace as a pre-push process.

madeofpalk 2 hours ago|||
it's basically a UI for a well-curated set of commits, and reviewing per commit.
IshKebab 18 minutes ago|||
1. Github's UI doesn't really support reviewing individual commits in a big PR.

2. It also can't merge subsets of commits from a single PR. E.g. if you have two commits, A and B, where B depends on A... sure you can make a PR containing A and B, but if A gets approved and B doesn't, then you can't merge A.

3. The thing you want to do with a set of commits and reviewing each commit IS stacked PRs.

This is nothing to do with AI.

EduardoBautista 2 hours ago|||
I feel it's more of a limitation of the GitHub UI. It is much easier to group together reviews and comments by PR than it is by commits.
hoppp 2 hours ago|||
I think it is designed for AI Pull Requests. My impression was that it's for reviewing large generated changes.
catlover76 1 hour ago||
[dead]
DDayMace 16 minutes ago||
It's good to have this feature, but it is still up to the individual developers to separate the PR work in a way that can be merged "all or some and in which order". It can make organizing, reviewing and rebasing easier but a PR with repeat, broken or overriding code can screw up just the same. I guess what I mean is, don't expect it to just sort out multiple PRs that wouldn't have worked together without it.
lucky_cloud 3 hours ago||
Is that why the menu toggle is the stack of pancakes emoji (U+1F95E)?

Whimsy is fine but that change made me super suspicious about what I was looking at.

sameenkarim 1 hour ago||
We've been using the pancake emoji internally so we thought it was a fun easter egg. It'll only be up for a few hours and then will go back to the regular icons :)
Waterluvian 15 minutes ago|||
I liked it. It’s nice to have little fleeting moments of what I call “Classic Web” feel.
patte 16 minutes ago||||
I was so happy when I saw that! There is joy and silliness left in GitHub! Thank you!
cebert 49 minutes ago|||
Good. This change was unexpected and so unprofessional I though my browser was compromised.
themanmaran 27 minutes ago|||
My lord people accept a little bit of whimsey in your lives.
Waterluvian 12 minutes ago||
Remember when the Internet was a culture? Now you attempt the most tame possible attempt at that culture and people go into the Issue tracker to throw their little fit.
hext 27 minutes ago|||
You thought your browser was compromised? Pathetic.
robin_reala 1 hour ago|||
Yes: https://github.com/orgs/community/discussions/203497
ebrahimh 2 hours ago||
For a moment, I thought it was a reddit-style account birthday badge
lucideer 2 hours ago||
Started using the gh stack CLI when I first heard of this feature & really liked it - great tooling. Then got approved for the preview & found the corresponding web UI features incredibly underwhelming.

Pre-approval the CLI tooling effectively enables easier automations around splitting a task into multiple atomic PRs - really great locally but then when you push they just show up as independent unlinked PRs.

Post-approval... they still show up as independent PRs. There's a small nav drop down up top listing the other PRs in the stack but that's it. Literally no meaningful UI changes.

The dropdown also allows you to perform a limited subset if the CLI functionality but this is similar to the ability to edit files in the UI - an optional extra casual use feature that won't be a part of dev workflows: the CLI (or IDE plugins I guess) would be the primary way to perform these actions.

It all left me wondering what the big deal with the preview not being a general release - it's extremely minor optional UI. The stacks cli has been general release since this was announced.

sameenkarim 1 hour ago|
I hear you. We had to start with something a bit more minimal, but we are working on a much broader revamp for the PR UI. Part of that will include a persistent view of the stack so you always know you're working with a stack and easily navigate between the layers without a ton of clicks.
tao_oat 3 hours ago||
Really excited to try this. After using Graphite it's been very hard going back to stack-less GitHub. Hopefully this can make the stacked PR workflow more common and give people an easier alternative to mammoth PRs.
theappsecguy 2 hours ago|
I'd recommend git-spice, it's very easy to use and powerful, and of course open-source. I've tried graphite but found that they made it too convoluted for what it is.
perspectivezoom 1 hour ago|||
I will second git-spice. It does exactly what you want and, importantly, no more than that. There's no upsell to anything else; it's "just" a good tool that knows its purpose and boundaries.
literallyroy 1 hour ago|||
How does git-spice compare to git-town?
theappsecguy 1 hour ago||
I haven't used git-town, but from a cursory look it appears to be a various collection of gitops improvements for day to day things, including some for stacking.

git-spice is specifically targeted to be useful for PR stacking and doesn't require you to do anything differently from normal git operations that you likely use already. It has a bunch of really nice flows and doesn't try to step outside the bounds of what is needed to easily stack PRs

shoyer 23 minutes ago||
When will this support "trees" of pull requests, with dependent changes? In my experience with stacked changes (from Google), it is often the case that changes do not stack up as a linear history. I imagine that would especially be the case these days with parallel coding agents.
sepeth 2 hours ago|
One of the nice things about jujutsu related to this is that when you update a branch, it rebases other branches started off of that branch. I often switch to jj if I want to split my work for easy reviewing, and it works great colocated with a clone created with git.
More comments...