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)功能,旨在帮助开发者管理具有依赖关系的系列合并请求。该功能允许用户将复杂任务拆分为较小的、可供审查的代码块,并以组为单位进行管理和合并,从而简化工作流程。 **核心亮点:** * **工作流程:** 开发者可以创建具有依赖关系的链式分支或 PR。这项新工具可帮助自动化处理这些堆叠分支的变基(Rebase)与合并过程。 * **核心痛点:** 大型单一 PR 往往难以审查和测试。堆叠式 PR 让审查者能专注于较小且逻辑清晰的工作单元,同时保持它们之间明确的依赖关系。 * **行业背景:** 支持者认为这有助于提高审查质量和效率(尤其是在 AI 生成代码的情况下);但批评者指出,这种工作流并非新鲜事物,在 Phabricator 和 Gerrit 等系统中已是多年来的标准做法。 * **市场反馈:** 早期反馈褒贬不一。许多开发者赞赏其为大规模代码变更提供了更好的工具支持;但也有人批评 GitHub 跟进太晚、存在厂商锁定问题,并认为这仅仅是在 UI 层面的修补,而非解决 Git 或代码审查本身的根本性问题。此外,部分用户还指出了 GitHub 在网站稳定性和 UI 性能方面持续存在的问题。
相关文章

原文

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