What is the difference between a repository ruleset and a branch protection rule in GitHub?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Rulesets are the evolution of branch protection rules. Instead of configuring protection branch by branch, you write one ruleset that pattern-matches across multiple branches or even multiple repos. It's centralized, scalable governance.
Full explanation below image
Full Explanation
Repository rulesets are a newer, more powerful alternative to branch protection rules. Key differences: (1) Rulesets can be managed at the organization or enterprise level and pushed down to repositories, while branch protection rules are per-repository. (2) Rulesets use pattern matching to apply to multiple branches or tags simultaneously, while branch protection rules target specific branch names. (3) Rulesets have an 'Evaluate' mode for testing before enforcement, while branch protection rules are binary (on/off). (4) Rulesets support bypass lists with specific actors. Both features can exist simultaneously. Rulesets do NOT support fewer rule types — they generally match or exceed branch protection capabilities.