Auto-merge

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

If the content of a merge request is ready to merge, you can select Set to auto-merge. The merge request auto-merges when all required checks complete successfully, and you don’t need to remember to manually merge the merge request.

Merge checks enable you to focus on reviewing a merge request’s contents, and use project settings to determine their mergeability. When you review a merge request, if you approve of the merge request’s changes, set it to auto-merge. GitLab enforces your project settings, and until the merge request satisfies all merge checks (like required Code Owner and approval rules), it cannot merge. After satisfying all required merge checks, the merge request merges, with no action required from you.

Merge checks include a passing CI/CD pipeline, and much more:

  • All required approvals must be given.
  • No other merge requests block this merge request.
  • No merge conflicts exist.
  • A CI/CD pipeline must complete successfully, regardless of the project setting.
  • All discussions are resolved.
  • The merge request is not a Draft.
  • All external status checks have passed.
  • The merge request must be open.
  • No denied policies exist.
  • All pipelines for the latest commit must succeed before the merge request is merged when scan execution policies or pipeline execution policies are configured.
  • If your project requires merge requests to reference a Jira issue, the merge request title or description contains a Jira issue link.
  • If a title validation pattern is configured, the merge request title must match the pattern.
  • If the merge request has a Merge after date set, the current time must be after the configured date.

For a full list of checks and their API equivalents, see merge status.

Auto-merge is ready

After you set auto-merge, you can’t change which issues auto-close when the merge request merges.

Auto-merge a merge request

Prerequisites:

  • You must have the Developer, Maintainer, or Owner role for the project.
  • If your project configuration requires it, all threads in the merge request must be resolved.
  • The merge request must have received all required approvals.

To do this when pushing from the command line, use the merge_request.merge_when_pipeline_succeeds push option.

To do this from the GitLab user interface:

  1. In the top bar, select Search or go to and find your project.

  2. In the left sidebar, select Code > Merge requests.

  3. Select the merge request to edit.

  4. Scroll to the merge request reports section.

  5. Optional. Select your desired merge options, such as Delete source branch, Squash commits, or Edit commit message.