默认情况下,如果您为任何分支创建Branch protection rule
,它就是Disables force-pushes to all matching branches and prevents them from being deleted
。因此,如果您使用模式master
创建规则,则默认情况下会阻止master
分支被删除。
关于规则模式的工作原理,它使用fnmatch
来匹配任何提供的模式,以找出规则适用的分支。例如:
*
的规则模式将适用于所有分支release*
的规则模式将适用于名称以release
开头的所有分支目前我不认为你可以在GitHub上设置任何单一规则模式(我已经尝试过)来匹配多个分支,例如master
和develop
,因为理想情况下{master,develop}
应该匹配两个分支,但目前它不匹配,并且根据fnmatch文档{a,b} matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled
在GitHub help和fnmatch documentation上查看有关上述内容的更多详细信息