How to configure branch protection
  • 05 Mar 2023
  • Dark
    Light
  • PDF

How to configure branch protection

  • Dark
    Light
  • PDF

Article Summary

There are many reasons to use branch protection, and many individual permissions that can help your team model your workflow.

To access your branch settings, click on the settings tab of any repo.

Here is an example branch settings tab:
Screen Shot 2023-03-05 at 2.52.27 PM.png

Enable branch protection

This is an upper level swtich. If this is not checked, none of the following settings will be applied

Disable push

This is recommended for your main branch and any closed or finalized branches. This keeps commits from being able to be pushed to this branch.

Enable push

Anyone with write access can push a commit to this branch.

Whitelist restricted push

Only people on the whitelist can push commits to this branch. This is to allow admin / expert fixing or adjusting of a repo, without giving everyone access.

Enable merge whitelist

Repo admins can have their merge permissions removed by enabling the merge whitelist and omitting them from the whitelist. Only people on the whitelist will be able to merge the design review.

Enable status check

Requires status checks to pass before merging.

Required approvals

Set to zero if allowing merge without approvals. Set to a number to count the number of required approvals to allow a merge. Note: if you change this after approvals come in, the design review won't count the number of approvals correctly.

Restrict approvals to whitelisted users or teams

We highly recommend using this feature, as our teams functionality is quite robust. Restrict approvals to people or teams added to this list.

Block merge on rejected reviews

Enable to block merging, even if there are enough approvals, if there is a rejected review. Repo admins will be able to merge unless you use a merge whitelist.

Block merge on official review requests

Enable to block merging, even if there are enough approvals, if there is an official review request. Repo admins will be able to merge unless you use a merge whitelist.

Dismiss Stale approvals

When new commits change the content of the pull request are pushed to the merge-in branch, old approvals will be dismissed.

Require signed commits

Enable this to reject commits that are not signed or the signature is unverifiable.

Block merge if design review / pull request is outdates

Enable this to block merging if the head branch is behind the base branch

Protected file patterns

Files that match these patterns will not be allowed to change, even if the user has permissions.

Unprotected file patterns

Files that match these patterns will be allowed to change directly if the user has write permissions

Update settings

You must click this to save any changes. Note that changing a design review after approvals have been made may cause the approvals to be miscounted, and you will have to manual merge.


Was this article helpful?