This feature is only available on our Enterprise plan. Contact sales for more information.
Merge restrictions are a tool admins can use to govern how branches are merged to the main branch. Specifically, admins can designate project reviewers who must approve all requests to merge branches to the main branch. Organization admins are not subject to merge restrictions, and can merge at any point.
Merge restrictions only apply when merging to the main branch, 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 the icon next to the project name to access more options .
-
Select Project Settings in the dropdown menu.
-
In the Project settings page, 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.
Requesting reviews on a merge restricted branch
If you've defined merge restrictions, the Merge button is disabled when contributors try to merge. They will need to request a review from the designated project reviewers and have their branch approved before they are cleared to merge to the main branch.