Merge request approval rules

  • Tier : Premium, Ultimate
  • Offering : GitLab.com, GitLab Self-Managed, GitLab Dedicated

Approval rules define how many approvals a merge request must receive before it can be merged, and which users should do the approving. They can be used in conjunction with code owners to ensure that changes are reviewed both by the group maintaining the feature, and any groups responsible for specific areas of oversight.

You can define approval rules:

You can configure approval rules:

If you don’t define a default approval rule , any user can approve a merge request. Even if you don’t define a rule, you can still enforce a minimum number of required approvers in the project’s settings.

Merge requests that target a different project, such as from a fork to the upstream project, use the default approval rules from the target (upstream) project, not the source (fork).

Merge request approvals can be configured globally to apply across all (or a subset) projects with policies . Merge request approval policies also provide additional flexibility with more granular configuration options.

Add an approval rule

Prerequisites:

  • You must have the Maintainer or Owner role for the project.
  • To add a group as an approver in GitLab.com, you must be a member of the group or the group must be public.

To add a merge request approval rule:

  1. In the top bar, select Search or go to and find your project.
  2. In the left sidebar, select Settings > Merge requests .
  3. In the Merge request approvals section, in the Approval rules section, select Add approval rule .
  4. In the right sidebar, complete the fields:
    • In Approvals required , a value of 0 makes the rule optional , and any number greater than 0 creates a required rule. Maximum number of required approvals is 100 .
    • From Add approvers , select users or groups that are eligible to approve . GitLab suggests approvers based on previous authors of the files changed by the merge request.
  5. Select Save changes . You can add multiple approval rules .

Your configuration for approval rule overrides determines if the new rule is applied to existing merge requests:

  • If approval rule overrides are allowed, changes to these default rules are not applied to existing merge requests, except for changes to the target branch of the rule.
  • If approval rule overrides are not allowed, all changes to default rules are applied to existing merge requests. Any approval rules that were previously manually overridden during the period when approval rule overrides where allowed, are not modified.

Edit an approval rule

Prerequisites:

  • You must have the Maintainer or Owner role for the project.
  • To add a group as an approver in GitLab.com, you must be a member of the group or the group must be public.

To edit a merge request approval rule:

  1. In the top bar, select Search or go to and find your project.
  2. In the left sidebar, select Settings > Merge requests .
  3. In the Merge request approvals section, in the Approval rules section, next to the rule you want to edit, select Edit .
  4. In the right sidebar, edit the fields:
    • In Approvals required , a value of 0 makes the rule optional , and any number greater than 0 creates a required rule. Maximum number of required approvals is 100 .
    • To remove users or groups, identify the group or user to remove, and select Remove ( remove ).
  5. Select Save changes .

Delete an approval rule

Prerequisites:

  • You must have the Maintainer or Owner role for the project.

To delete a merge request approval rule:

  1. In the top bar, select Search or go to and find your project.
  2. In the left sidebar, select Settings > Merge requests .
  3. In the Merge request approvals section, next to the rule you want to delete, select the trash can ( remove ).
  4. Select Remove approvers .

Multiple approval rules

To enforce multiple approval rules on a merge request, add multiple default approval rules for a project.

When an eligible approver approves a merge request, it reduces the number of approvals left (the Approvals column) for all rules that the approver belongs to:

The approvals widget displaying Code Owners rules with eligible approvers, requirements, and approval status.

Membership type Approval rules Code Owners
Direct member of the project check-sm check-sm
Direct member of the project’s group check-sm check-sm
Inherited member of the project’s group check-sm check-sm
Direct member of a group invited to the project check-sm check-sm
Inherited member of a group invited to the project No No
Direct member of a group invited to the project’s group check-sm check-sm
Inherited member of a group invited to the project’s group No No
Direct member of a group invited to the project’s group’s parent groups check-sm check-sm
Inherited member of a group invited to the project’s group’s parent groups No No

Group type Approval rules Code Owners
Groups invited to the project check-sm check-sm
Groups invited to the project’s group check-sm No
Groups invited to a parent of the project’s group check-sm No
The project’s group check-sm check-sm
A parent of the project’s group check-sm check-sm