GitHub「Require linear history」点击「Update branch」时行为与预期相反
关于GitHub分支保护「Require linear history」的逻辑矛盾
假设我们有基准分支main和新分支feature1,且feature1并非基于main的最新提交,分支结构如下:
x - x - x <-- main \ x <-- feature1
- 当为
feature1开启分支保护规则中的Require linear history时,GitHub的PR界面仅显示「Update branch」按钮,点击该按钮会创建一个main→feature1的合并提交——这与「Require linear history」(要求线性提交历史)的核心含义完全相悖。 - 当关闭「Require linear history」复选框时,GitHub的PR界面反而会显示「Update with merge commit」和「Update with rebase」两个可选操作按钮。
合理的逻辑应该是相反的:开启「Require linear history」时,GitHub界面应该仅提供rebase分支更新操作,这样才能符合线性提交历史的要求。
内容的提问来源于stack exchange,提问作者Dzmitry Lazerka
相关产品推荐
相关产品推荐

