Automatic Merging When Builds Pass

Today Bitbucket is releasing a new labs feature, "Pending Merges", which allows for automatic merging of pull requests when builds pass. This means no more continually checking back in on your pull request, just waiting and waiting for your builds to pass before you can finally merge it. You will no longer be forced to begrudgingly fix that one-character whitespace typo in your comment that you really should fix, but that means you're in for another 30-60 minutes of watching your builds. Even if your builds just take 1-2 minutes, we get it. Who wants to watch builds?

This functionality works in essentially the same manner that you’d otherwise merge your pull request. When you have all required merge checks except successful builds completed, you will be able select the Merge option and we’ll take it from there.

How to Use Automatic Merging

In three pictures:

Select Merge on the open pull request.

And when all that’s remaining is passing builds…

You will be able to go ahead and request a merge of the change.

Screen showing how to request automatic merging

If the builds pass, we’ll go ahead and merge the change. But if they fail, we won’t merge the change and we’ll send a notification to the user that requested the merge.

An example e-mail notification for when builds fail

Merge Checks Support

This functionality works alongside merge check requirements, so branches that have required merge checks (such as a required number of approvers, all tasks being resolved, etc.) will have those checks honored. This works by preventing the option the merge if there are any open merge checks, with the exception of successful builds.

An example change that doesn’t have the required number of approvals
Results in not being able to request a pending merge

Configuring Automatic Merging

By default this functionality is not enabled on repositories, and must be enabled on each branch that wishes to grant the ability to automatically merge when builds pass.

This is selectable by repository administrators under Repository Settings -> Branch Permissions -> Edit/Add branch permission -> Allow automatic merge when builds pass.

This functionality must be enabled under the “Branch permissions” workflow

Update (February 4th, 2021): As of today we are beginning to roll out this feature to all users. You may still currently opt in or out through the labs features page, but users will begin to be opted-in by default.

To try Pending merges, you'll need to enable the functionality inĀ Bitbucket labs. Pending merges is being released as a beta feature. We would love to hear your feedback before we promote the feature to all users. If you have anything to share, please click the Give feedback link under the Pending merges feature on the labs page.

The feature is available in Bitbucket Labs

Happy merging!