Checks for merging pull requests

Still need help?

The Atlassian Community is here for you.

Ask the community

Merge checks are used to prevent pull requests from being merged until your required conditions are met. 

Pull requests provide a way to do peer code reviews and merges as part of a branch-based development workflow and help protect your production code. But as your team grows you might need more flexibility, and merge checks help ensure pull requests are fully vetted before they are merged without creating a code review bottleneck or completely locking down a repository. 

On this page:

Default merge checks

Bitbucket Server comes with some merge checks by default that are disabled, but can be enabled (or disabled) at the project level for all repositories in a project, or for individual repositories.

The default merge checks that come with Bitbucket Server are:

  • All reviewers approve - requires all reviewers to approve a pull request before merging.
  • Minimum approvals - requires at least the specified number of approvals before merging.
  • Minimum successful builds - requires at least the specified number of successful builds before merging.
  • No incomplete tasks - requires all tasks to be complete before merging.

Configure merge checks for all repositories in a project

Enabling (or disabling) merge checks at the project level changes merge checks for repositories set to inherit project settings. If you previously changed merge checks for an individual repository, that repository's configuration will not change when configuring merge checks at the project level.

To enable (or disable) merge checks for repositories in a project (requires project admin permissions):

  1. Go to Project settings > Merge checks.
  2. Click the toggle by the merge check to enable (or disable) it.

 

Merge checks for repositories set to Inherited in the project will now reflect this new configuration. Merge checks explicitly configured at the repository level will not be affected. 

Configure merge checks for an individual repository

Enabling (or disabling) merge checks at the repository level enables a merge check for all pull requests created in that repository. Configuring merge checks at the repository level will override any checks configured at the project level. If you have not configured merge checks for an individual repository it will inherit merge checks configured at the project level.

To enable (or disable) merge checks for a single repository (requires repository admin permissions):

  1. Go to Repository settings > Merge checks.
  2. Use the drop menu to the right of the merge check to set it.
    1. Inherited - uses the configuration set at the project level.
    2. Enabled - enforces the conditions of the merge check.
    3. Disabled - ignores the conditions of the merge check.

 

Once set, any changes made to a merge check configuration at the project level will be ignored for this repository because it was changed independent of the project configuration.

Inherited merge check configurations

By default, Bitbucket Server comes with merge checks disabled at the project and repository level. Unless merge checks were configured at the repository level, enabling or disabling merge checks at the project level inherits the configuration at the repository level. 

For example, if you enabled the No incomplete tasks merge check for a project, and a repository merge check configuration was unchanged, each repository would have the No incomplete tasks merge check enabled.

Merge check disabled, project level

Merge check disabled, repository level

Merge check enabled, project level

Merge check enabled, repository level

 

Now suppose you decide that the No incomplete tasks merge check isn't appropriate for one specific repository. You can change that individual repository's merge checks independent of how it's configured at the project level. Any changes made to merge check configuration at the project level for the No incomplete tasks will be ignored for this repository, because it was changed independent of the project configuration.

Merge check enabled, project level

Merge check disabled, repository level

Add a new merge check

Additional merge checks can be installed by system administrators and can also be enabled for all repositories in a project, or for individual repositories.

To add merge checks from the Atlassian Marketplace (requires system admin permission):

  1. Go to Project settings > Merge checks.
  2. Click Add merge check.
  3. Search for a merge check to add, and click Install

 

Once you add a new merge check, you can enable (or disable) it in the same way as the default merge checks.

Create a merge check

You can also write your own merge request check plugin.

Last modified on Jul 11, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.