By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch. You can choose to enforce restrictions on how a pull request is merged into your repository.
Repository owners and people with admin permissions for a repository can enforce certain workflows or requirements, before a collaborator can merge a branch in your repository 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
release to have at least two pull request reviews before merging, you can create a branch rule for
*release*. For more information, see "Configuring protected branches."
If a repository has multiple protected branch rules that affect the same branches, the rules that include a specific branch name have the highest priority. If there is more than one protected branch rule that references the same specific branch name, then the branch rule created first will have higher priority.
Protected branch rules that mention a special character, such as
], are applied in the order they were created, so older rules with these characters have a higher priority.
When you create a branch protection rule in a repository, collaborators cannot force push to the protected branch or delete the branch by default. You can enable other branch protection settings. For information, see "Defining the mergeability of pull requests."