保护Github分支不被删除

问题描述 投票:0回答:1

对于回购,看起来像Github UI更改了设置/分支。我再也无法弄清楚如何防止分支被删除。

enter image description here

有谁知道如何防止分支被删除?阿卡,保护分支?

github
1个回答
2
投票

默认情况下,如果您为任何分支创建Branch protection rule,它就是Disables force-pushes to all matching branches and prevents them from being deleted。因此,如果您使用模式master创建规则,则默认情况下会阻止master分支被删除。

关于规则模式的工作原理,它使用fnmatch来匹配任何提供的模式,以找出规则适用的分支。例如:

  • 作为*的规则模式将适用于所有分支
  • 作为release*的规则模式将适用于名称以release开头的所有分支

目前我不认为你可以在GitHub上设置任何单一规则模式(我已经尝试过)来匹配多个分支,例如masterdevelop,因为理想情况下{master,develop}应该匹配两个分支,但目前它不匹配,并且根据fnmatch文档{a,b} matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled

GitHub helpfnmatch documentation上查看有关上述内容的更多详细信息

© www.soinside.com 2019 - 2024. All rights reserved.