github

What are the practical differences between GitHub Rulesets and Branch Protection Rules?


I searched for this, but every page seems to refer to one or the other rather than comparing the two.

When should someone use one or the other and are their considerations to keep in mind when switching between the two?


Solution

  • What are the practical differences between GitHub Rulesets and Branch Protection Rules?

    I found a succinct answer somewhat buried in a Note:

    Only a single branch protection rule can apply at a time, which means it can be difficult to know which rule will apply when multiple versions of a rule target the same branch. For information about an alternative to branch protection rules, see About rulesets.


    When should someone use one or the other and are their considerations to keep in mind when switching between the two?

    (By analogy; I compare Branch Protection Rules to be like Unix-style filesystem permissions, while Repository Rules are more like NTFS ACLs).

    Also, the term "Repository Rules" is a bit of an understatement because the system also supports Organization-wide rules as well, provided you're paying GitHub for the privilege:

    For organizations on the GitHub Enterprise plan, you can set up rulesets at the organization level to target multiple repositories in your organization