About protected branches
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.
Protected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. Enabling protected branches also allows you to enable other optional checks and requirements, like required status checks and required reviews.
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 configuring protected branch settings. For more information, see "Configuring protected branches."
Branch protection settings
When you enable branch protection for a specific branch, collaborators cannot force push to the protected branch or delete the branch by default. You can enable other branch protection settings, so that collaborators:
- Can't merge changes into the protected branch unless required status checks pass. For more information, see "About required status checks."
- Can't merge changes into the protected branch until required reviews are approved. For more information, see "Approving a pull request with required reviews."
- Can't edit the protected branch or upload files to it from the web
- Can't merge changes into the protected branch until changes to files that have a designated code owner have been approved by that owner. For more information, see "About code owners."
- Can't push commits to the protected branch that are not signed and verified. For more information, see "About required commit signing."
If your repository is owned by an organization, you can restrict users or teams from pushing to a protected branch. For more information, see "About branch restrictions."