GitHub Stacked PRs 正式版发布:支持自动合并、审批保留与签名
Stacked pull requests generally available
核心协作工作流重大升级,建议开发者立即尝试以优化大型重构或复杂功能的拆分与合并效率。
GitHub stacked pull requests are now generally available. Break large changes into smaller, focused pull requests that you can review independently and merge together.
GitHub 堆叠拉取请求现已全面可用。将大型变更拆分为更小、更聚焦的拉取请求,以便独立审查并合并。
Since the feature went into public preview, repositories using stacks have seen a 9% increase in merged code compared to peers. Over two-thirds of the top 1% of repos now use stacked pull requests and have seen a 5% improvement in time-to-merge.
自该功能进入公开预览阶段以来,使用堆叠功能的仓库相比同类仓库,已合并代码量增加了 9%。目前,前 1% 的顶级仓库中有超过三分之二使用了堆叠拉取请求,且合并时间缩短了 5%。
With this general availability release, we’re introducing several improvements to make stacks easier to create, review, and merge. Thank you to everyone who provided feedback and input during the preview period.
随着此次全面发布,我们引入了多项改进,使堆叠的创建、审查和合并更加便捷。感谢所有在预览期间提供反馈和建议的用户。
More flexible merging and rebasing
更灵活的合并与变基操作
- Approvals stay in place for unchanged code. When an otherwise unchanged stack is updated after its base branch, such as main, moves ahead, Rebase stack now preserves approvals, even in repositories that dismiss stale approvals.
- Rebased commits stay signed. GitHub creates signed replacement commits during Rebase stack, preserving original authorship. Automatic rebases after partial merges also sign replacement commits when branch rules require signatures or any original commit was signed.
- Bypass permissions apply to stacks. Users with permission to bypass repository rules can now use those permissions to merge the lowest unmerged pull request in a stack.
- More consistent stack merging. A stack now enters and lands through the merge queue as a single merge group. When using the merge commit method, GitHub now creates one merge commit per pull request instead of one for the entire merged group.
- Branching stacks retarget automatically. When a stack’s base branch is deleted, GitHub automatically retargets the stack instead of closing its bottom pull request. This supports workflows where one stack branches off another.
- Auto-merge for stacks rolling out over the next few weeks. Stacked pull requests can be set to merge automatically once the repository’s merge requirements are met. Select a group of pull requests and they will all merge together once all the pull requests are ready to merge.
- 未更改代码的审批状态得以保留。当基础分支(如 main)向前移动后,对原本未更改的堆叠进行更新时,“Rebase stack”(重设堆叠)功能会保留审批状态,即使在会清除过期审批的仓库中也同样适用。
- 变基后的提交保持签名。GitHub 在“Rebase stack”过程中会创建带签名的替换提交,以保留原始作者信息。在部分合并后自动执行变基时,如果分支规则要求签名或任何原始提交已签名,则替换提交也会带有签名。
- 绕过权限适用于堆叠。拥有绕过仓库规则权限的用户现在可以使用这些权限来合并堆叠中最低层尚未合并的拉取请求。
- 更一致的堆叠合并方式。堆叠现在作为一个单一的合并组进入并通过合并队列完成合并。在使用合并提交方法时,GitHub 现在为每个拉取请求创建一个合并提交,而不是为整个合并组仅创建一个。
- 分支堆叠自动重新定位。当堆叠的基础分支被删除时,GitHub 会自动重新定位堆叠,而不是关闭其最底层的拉取请求。这支持一个堆叠从另一个堆叠分叉的工作流程。
- 未来几周将推出堆叠的自动合并功能。满足仓库的合并要求后,堆叠拉取请求可设置为自动合并。选择一组拉取请求,当它们全部准备好合并时,将一起合并。
Stack navigation and automation
堆叠导航与自动化
- Stack context stays visible. Stack information is now always visible in the pull request page’s persistent header. View details about the stack that a pull request belongs to from the pull requests list view.
- Keyboard shortcuts. Use Shift+J and Shift+K shortcuts to navigate between pull requests in a stack.
- Stack membership lifecycle. View events in the timeline for when a pull request was added or removed from a stack. The pull_request webhook now includes a stacked action when a pull request joins a stack.
- CLI and agent workflows support more ways to work. The gh stack extension for GitHub CLI now supports Git worktrees and includes several improvements to speed up initialization, checkout, and navigation.
- 堆叠上下文始终保持可见。堆叠信息现在始终显示在拉取请求页面的固定页眉中。可以从拉取请求列表视图中查看所属堆叠的详细信息。
- 键盘快捷键。使用 Shift+J 和 Shift+K 快捷键在堆叠中的拉取请求之间导航。
- 堆栈成员生命周期。在时间线中查看拉取请求被添加或移除出堆栈的事件。当拉取请求加入堆栈时,pull_request webhook 现在包含一个 stacked action。
- CLI 和代理工作流支持更多工作方式。GitHub CLI 的 gh stack 扩展现在支持 Git worktrees,并包含多项改进以加快初始化、检出和导航速度。
Get started
开始使用
Stacked pull requests are available on all github.com plans and will be included in an upcoming GitHub Enterprise Server release.
堆叠式拉取请求在所有 github.com 计划中均可用,并将包含在即将发布的 GitHub Enterprise Server 版本中。
Check out the stacked pull requests documentation to learn more about the feature and how to get started.
查看堆叠式拉取请求文档,了解更多关于该功能以及如何开始使用的信息。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力