Bulk migrate branch protections to rulesets for a repository
By Steven Van ·
Admins can preview, select and create rulesets from all of a repository's branch protection rules at once, then keep or delete the originals.
Repository admins can now convert every branch protection rule in a repository to rulesets in one step. It extends the earlier option to GitHub that converted a single rule at a time, and the documentation describes how the conversion works.
How the bulk import works
In a repository, go to Settings, then Rulesets, and click Import branch protection rules. A Review import dialog opens before anything is created. In it you can:
- Preview the rulesets that will be created.
- See which branch protection rules an existing ruleset already covers.
- Review cases where one branch protection rule produces multiple rulesets to preserve its original behavior.
- Choose an enforcement status (Active, Evaluate or Disabled) and select which rulesets to create.
After you click Create rulesets, you choose whether to keep or delete the original branch protection rules.
Keeping the original rules
The documentation says that a kept branch protection rule continues to protect matching branches. An Active ruleset is enforced alongside it, so changes must satisfy both. Once a ruleset fully covers a rule, the Branches settings page shows that the rule can be safely deleted. GitHub recommends confirming the new ruleset behaves as expected before deleting the original.
Why rulesets
The changelog lists these advantages over classic branch protections:
- Rules can apply across multiple branches with pattern matching.
- Multiple rulesets can be layered for finer policy control.
- Rulesets can be managed at the organization or enterprise level.
- Bypass permissions can be set for users, teams and apps.
Availability
The feature is available in all repositories where rulesets are available. That means public repositories on GitHub Free and GitHub Free for organizations, and public and private repositories on GitHub Pro, GitHub Team and GitHub Enterprise Cloud. Creating, editing and deleting rulesets requires admin access to the repository, or a custom role with the "edit repository rules" permission.

