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.

If you own a repository with multiple collaborators who create branches and open pull requests, you may need to enforce branch protections to keep your project and pull requests organized and safe.

Protected branches block some features of Git on a branch that a repository administrator chooses to protect. When you enable protected branches on a branch, collaborators:

  • Can't force push to the branch
  • Can't delete the branch

For more information, see "Configuring protected branches."

After enabling protected branches on a branch, you can choose to enable other optional checks and requirements, so that collaborators:

If your repository belongs to an organization, you can restrict users or teams from pushing to a protected branch. For more information, see "About branch restrictions."

Further reading