Latest / The CTO Podcast with Fexingo: Technical Leadership, Architecture, and Engineering Org / How GitHub Cut Merge Conflicts by Half with Stacked PRs
Transcript
- Lucas: So a few months back, GitHub's engineering team published a breakdown of how they'd reworked their own pull request workflow, and the headline number was a fifty percent reduction in merge conflicts. That's not a tweak, that's a fundamental shift in how they ship code. Luna: Fifty percent is huge. Were they just getting better at merging, or did they change the whole model? Lucas: They changed the model. They moved from the classic one-branch-per-feature flow to something called stacked pull requests. Instead of one massive PR that sits open for two weeks, you break the work into a chain of smaller, dependent PRs — each one builds on the last. Think of it like a stack of cards. Luna: So you're reviewing the bottom card first, and the top card depends on it. That sounds like it could get messy. Lucas: It can, if you don't have the right tooling. But GitHub built internal tooling to make it seamless. The key insight is that each PR in the stack targets the previous PR, not the main branch. So you're not waiting for one massive review to land before you start the next piece. Luna: And that's what kills the latency. Reviewers can look at smaller, more focused changes, so they're less intimidating and they get done faster. Lucas: Exactly. They saw review latency drop from a couple of days to a few hours. That's the multiplier. When your feedback loop shortens, you catch issues earlier, and you spend less time rebasing and untangling conflicts. Luna: It's like the difference between writing an essay and sending it to a professor once, versus writing it chapter by chapter and getting feedback as you go. Lucas: That's the analogy I've been looking for. And the numbers back it up — fifty percent fewer merge conflicts, but also a measurable increase in deploy frequency. They weren't just making developers happier, they were shipping more. Luna: So for our listeners who are CTOs or tech leads — is this something you can actually adopt without a team of tooling engineers? Lucas: That's the question, right? Because GitHub has a massive infrastructure team. But the pattern itself is tool-agnostic. There are open-source tools like Graphite and Practo that support stacked PRs, and even native Git can handle it with some discipline. Luna: But the discipline part is the hard part. I imagine it requires a cultural shift, especially for teams used to the one giant pr approach. Lucas: It does. You have to break the habit of bundling everything into one review because that feels safe. Stacked PRs force you to think in small, logical units. It's a skill, but it's learnable. And honestly, the payoff is worth it. Luna: I've been on teams where a PR would sit for a week just because it was too big to review in one sitting. The reviewer would put it off, and then the merge conflicts pile up. Lucas: That's the vicious cycle. The longer a PR lives, the more it diverges from main, and the more painful the merge. Stacked PRs break that cycle by keeping each change small and reviewing it quickly. Luna: So what's the catch? There has to be a downside. Lucas: The main downside is cognitive overhead. You're managing multiple branches, and you need to be careful about the order of merges. If you merge the top of the stack before the bottom, you can break things. But modern tooling handles that dependency tracking for you. Luna: And I guess it also changes the review culture. You can't just say 'look at the whole feature' — you have to review each piece in context. Lucas: Right. Reviewers need to understand that each PR is part of a larger whole. That's where documentation and good PR descriptions become critical. You have to write a clear narrative across the stack. Luna: It feels like a return to the fundamentals of good engineering: small changes, fast feedback, and continuous integration. Lucas: It really is. And the interesting thing is, this isn't a new idea. The concept of stacked diffs has been around since the early days of distributed version control, but it's only recently that tooling has made it practical for broad adoption. Luna: Which makes sense — the tools have to catch up with the theory. And GitHub has the resources to test it at scale and prove that it works. Lucas: And that's the beauty of a company like GitHub using its own product. They can validate the practice internally and then share those learnings with the community. Luna: Before we go deeper into the mechanics, I want to take a step back. We've been talking about how this workflow saves time and reduces friction. And that's exactly why we do this show — to help you build and run things better. And we're able to do that because we don't have ads interrupting the conversation. Lucas: That's right. We keep Fexingo Business ad-free, and listener support is what keeps it that way. If you're getting value from these episodes, you can help out at buy me a coffee dot com slash fexingo. It's a simple way to say thanks and keep the show independent. Luna: Yeah, no pressure, but it does make a difference. Now, Lucas, you were about to explain how the dependency tracking actually works in a stack. Lucas: Right. So imagine you have three PRs in a stack: A, B, and C. PR A is the foundation, PR B builds on A, and PR C builds on B. The tool tracks that B's base branch is A, and C's base branch is B. When you merge A, the tool automatically retargets B to main, and so on. Luna: So it's like a cascading merge. That's clever. But what about conflicts between the PRs in the stack itself? Lucas: That's the tricky part. If you modify a file in PR B that was also changed in PR A, you'll get a conflict within the stack. The tooling can help, but you still have to resolve it manually. That's why it's important to keep the changes in each PR truly independent. Luna: So the skill is in breaking apart a feature into clean, non-overlapping pieces. That's a design skill as much as a coding skill. Lucas: Definitely. And it's something that gets easier with practice. Teams that adopt stacked PRs often start with small features and gradually take on larger ones as they get the hang of it. Luna: I've also heard that stacked PRs can help with asynchronous teams. If you're in different time zones, you can keep working on the next PR while waiting for review on the current one. Lucas: That's a huge benefit. You're never blocked on a review. You can always be making progress on the next layer. That's a big deal for distributed teams, which is most teams these days. Luna: So what's the typical adoption curve? How long does it take for a team to become proficient? Lucas: From what I've seen, it takes about a sprint to get comfortable with the mechanics, and maybe a month to really internalize the practice. The biggest hurdle is breaking the habit of creating large PRs. Luna: And what about the reviewers? They have to adjust their mindset too. Lucas: Absolutely. Reviewers need to understand that they're reviewing a sequence, not a standalone change. They have to think about how this PR fits into the larger picture. It's a different kind of attention. Luna: I imagine that's where a lot of resistance comes from — reviewers who feel like they're seeing less context. Lucas: That's a real concern. But the counter is that each PR is more focused, so you can review it more thoroughly. And you can always look at the whole stack if you need the full context. Most tools have a way to view the entire diff. Luna: So it's not like you're flying blind. You have the option to see the big picture, but you can also focus on one piece at a time. Lucas: Exactly. And that flexibility is what makes it work. It's not a rigid process — it's a tool that gives you options. Luna: I'm curious, are there any metrics beyond merge conflicts and review latency that showed improvement for GitHub? Lucas: They also saw a decrease in the number of times developers had to update their PRs after initial submission. That's a sign that reviews were catching issues earlier, before the code got too far along. And deploy frequency went up, which is the ultimate metric. Luna: So the whole pipeline gets faster. It's a virtuous cycle. Lucas: It is. And that's why I find this pattern so compelling — it's not just a developer convenience, it's a business lever. Faster shipping, higher quality, and less context switching for the whole team. Luna: For a CTO, that's the kind of investment that pays for itself many times over. But it does require some upfront training and tooling. Lucas: Yeah, but the return is real. And given that GitHub proved it at their scale, it's worth considering for any team that's serious about improving their delivery pipeline. Luna: I think the key takeaway for our listeners is that you don't need to be a tech giant to benefit from this. There are accessible tools and a proven playbook. Lucas: Absolutely. Start small, pick a non-critical feature, and see how it feels. The numbers will likely speak for themselves.