About protected branches

Protected branches ensure that certain conditions are met before deploying changes to branches, like required status checks and required reviews.

By default, deployment requests can be opened and deployed by all collaborators, as long as the changes pass Salesforce validation. You can choose to enforce restrictions on how a deployment request is deployed in your repository.

Repository owners and can enforce certain workflows or requirements, before a collaborator can deploy, by creating protected branch rules.

You can create a branch rule in a repository for a specific branch, all branches, or any branch that matches a naming pattern specified with the fnmatch syntax. For example, to require any branch containing the word prod to have at least two peer reviews before deploying, you can create a branch rule for *prod*. For more information, see "Configuring protected branches."

Evaluation of multiple matching rules

If a repository has multiple protected branch rules that affect the same branches, the most restrictive settings from each rule have the highest priority. For example, if there is one rule that requires 2 peer reviews and another rule requires 4, then the number 4 takes higher priority.