Configuring protected branches

If you're a repository owner, you can customize branch protections in the repository and enforce certain workflows, such as requiring more than one peer review or requiring certain status checks to pass before allowing a deployment request to be deployed.

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 fnmatchfnmatch - Unix filename pattern matching, which is different from regular expressions. 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*.

You can also set up automatic branch protection for all branches in your repository with the wildcard syntax *. For example, qa/* will match all branches beginning with qa/. For more information about syntax options for branch rules, see the fnmatch documentation.

  1. Step by Step
  1. By step by step

  2. Instructions with screenshots