It looks like the Github UI changed for settings/branches for a repo. I can no longer figure out how to prevent a branch from being deleted.
Does anyone know how to prevent a branch from being deleted? Aka, protect the branch?
It looks like the Github UI changed for settings/branches for a repo. I can no longer figure out how to prevent a branch from being deleted.
Does anyone know how to prevent a branch from being deleted? Aka, protect the branch?
By default if you create a Branch protection rule for any branch, it Disables force-pushes to all matching branches and prevents them from being deleted. So if you create a rule with the pattern master, it would prevent the master branch from deletion by default.
About how the rule pattern works, it uses fnmatch to match against any pattern provided to find out the branches to which the rule applies. For eg :
* would apply to all the branchesrelease* would apply to all the branches whose name starts with releaseCurrently I don't think you can set any single rule pattern on GitHub (I have tried) to match multiple branches like for eg master and develop, since ideally {master,develop} should match both the branches, but currently it doesn't, and according to the fnmatch documentation {a,b} matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled
Check out more details on the above on GitHub help and the fnmatch documentation