This feature is only available on our Enterprise plan. Contact sales for more information.
Merge restrictions are a permissioning tool admins can use to govern how branches are merged to master. Specifically, admins can designate project reviewers who must approve all requests to merge branches to master. Organization admins are not subject to merge restrictions, and can merge at any point.
Note: Merge restrictions only apply when merging to master, not when merging child branches into parent branches.
Enable merge restrictions
Admins can define merge restrictions per project. To set merge restrictions on a project:
- Navigate to the project where you’d like to define merge restrictions.
- Click Project settings in the bottom left sidebar.
- Under Project settings, click the Restrictions tab.
- Add reviewers and change restrictions to the desired settings.
- Click Save changes.
- In the Reviewers section, add the names of Organization Members who must review all requests to merge before a branch can be merged.
- In the Review approval minimum section, choose how many required reviewers must review and approve a branch before it can be merged. Any admin that approves a branch counts towards this minimum, even if not listed under as a project reviewer above.
- In the Dismiss reviews section, toggle ON the switch if you’d like to revoke reviews (pending, approved, or with change requests) once a new commit has been added to a branch. Toggle OFF the switch if you’d like reviews (pending, approved, or with change requests) to persist even after new commits are added to the branch.
Request access to a restricted branch
When contributors on your team go to merge, the Merge branch button will be disabled if you’ve previously defined merge restrictions. They’ll need to request a review from the designated project reviewers and have their branch approved before they are cleared to merge to master.