GitHub 现已支持堆叠式 PR (Stacked PRs)。
Stacked PRs are now live on GitHub

原始链接: https://github.blog/changelog/2026-07-30-stacked-pull-requests-are-now-in-public-preview/

堆叠式拉取请求(Stacked pull requests)通过将庞大且复杂的特性拆分为一系列有序的、易于管理的小型拉取请求,从而简化了开发流程。这种方法允许团队并行审查和合并更改,避免了大型单体 PR 常带来的瓶颈问题。 通过维护依赖有序的层级,堆叠式 PR 确保审查者能够专注于代码的逻辑片段,从而实现更快、更准确的反馈,同时仍符合现有的分支保护和合并要求。在各层级获得批准后,它们可以被单独合并,也可以一次性合并。 堆叠式 PR 完全集成于 GitHub 生态系统(包括 CLI、移动端应用程序和 Copilot),能够自动执行变基(rebase)和重定向(retargeting)等繁琐任务,显著减少了开发工作流程中的摩擦。该功能现已处于公开预览阶段,使开发者能够以小型增量更新的效率和质量控制能力,交付大规模项目。

GitHub 已正式推出“堆叠式 PR”(Stacked PRs)功能,旨在帮助开发者将大型、复杂的变更拆分为更小、更易于管理和审核的单元。 这一消息在 Hacker News 上引发了热烈反响,许多开发者认为堆叠式工作流是替代“庞大”PR 的更优方案。用户指出,原生支持简化了开发流程,甚至有人已经通过 AI 智能体将其集成到工作流中,以精简审核过程。 然而,讨论中也出现了一些批评声音。尽管许多人欢迎这一工具,但一些高级用户认为,主流平台过于关注 Git 工作流的自动化,而非改善代码审核的人文体验。建议的改进包括为作者提供“路标”式注释、优化顶级评论的线程化显示,以及支持跨仓库堆叠 PR。尽管社区呼吁增加更多以审核为中心的功能,但总体而言,原生堆叠支持被视为一项迟来且积极的体验改善更新。
相关文章

原文

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.

“We’ve been using GitHub stacked PRs for Next.js for the past few months. It has helped us introduce smaller individual changes while shipping larger features, making it easier to review PRs. – Tim Neutkens, NextJS lead, Vercel”

With stacked pull requests, teams can:

  • Keep large changes moving by reviewing short, narrowly scoped pull requests in parallel.
  • Maintain quality across every layer by using focused pull request reviews alongside existing branch protections to protect main.
  • Merge one, some, or all by landing an entire stack altogether or individual layers one at a time.

And because stacked pull requests are built into GitHub, your existing reviews, checks, and merge requirements all work out of the box.

“The new Github Stacked PRs preview is incredible. Landing 5 stacked PRs directly to a merge queue all at once! A+++! This removes so much friction (and the gh cli tools + agent skill help a ton)” – John Resig, creator, jQuery

Install the CLI extension and create your first stack in under a minute:

gh extension install github/gh-stack

Work with stacks on 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.

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.

“AI has made TED’s developers dramatically more productive, but that created a new bottleneck: PRs were growing large enough that reviewers were struggling. Stacked PRs help to solve that. By breaking large changes into small, dependency-ordered pieces, review happens in smaller logical chunks – not just faster PR reviews, but more accurate ones. Stacked PRs tighten our feedback loop and help get stable code to ted.com faster.” – Andy Merryman, CTO, TED

view of the GitHub pull request page displaying details about the pull request stack

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.

“A big change used to mean one giant PR nobody wanted to review. Now it’s a stack of small ones reviewers can actually follow, and the whole stack merges in one shot. It stopped feeling like a tool on top of GitHub and started feeling like GitHub.” – Mayank Saini, connectivity engineer, WHOOP

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 stacks discussion.

联系我们 contact @ memedata.com