Merge a pull request

You can merge a pull request if you have write (or admin) permission on the project.

Bitbucket Data Center and Server does not enforce particular review workflows, so anyone with write permission on the repository can merge a pull request, including the person who opened it. This flexibility allows different teams to have different approaches to using Bitbucket. If your team requires stricter control, consider using branch permissions to restrict who can merge a pull request to particular users or groups. You might also want to consider using a plugin to enforce a particular workflow, for example to ensure that only approvals from members of your review team allow merging. See the page Checks for merging pull requests for details about enabling merge checks.

To merge a pull request:

  1. In the top-right corner of the pull request view, select Merge.
  2. In the Merge pull request dialog, you can add information about the pull request in a comment. The text you add appears between the subject line and the log lines that Bitbucket and Git generate, and adds the text to the commit message for the merge.
  3. Select a merge strategy from the menu and then select Merge
    Git merge strategies affect the way the Git history appears after a merge has occurred. Administrators can configure which merge strategies are available and which merge strategy will be the default. Learn more about pull request merge stategies

The Merge pull request dialog

Customize a commit message for your pull requests

A commit message appears in the Merge pull request dialog. In your project or repository, you can use the default template or create a custom template for commit messages. You can configure this behavior in the Commit message template section on the Merge strategies page. Under Template behavior, select one of the options:

  • Use the default template: you won’t be able to edit the commit message template in the merge strategies but you’ll be able to change your commit messages when merging pull requests.

  • Use a custom template: you’ll be able to edit the commit message template immediately, as well as change your commit messages when merging pull requests.

Commit message template configuration

Learn more about pull request merge strategies

Delete source branch after merging

When merging a pull request, you can choose to Delete source branch after merging to keep your branch list clean.

If you choose to delete the source branch, any open pull requests targeting the source branch will be retargeted to the target branch. Select the affected pull requests link within the dialog to view the pull requests that will be modified.

Before deleting your source branch, Bitbucket will do some checks. The branch being merged will not be deleted if:

  • The branch is the default repository branch.
  • The user does not have permission to delete the branch.

Once accepted, the pull request is marked as merged on the Pull requests tab. If Bitbucket detects a conflict that prevents the merge, notifications are displayed on the Overview and Diff tabs of the pull request. Click More information to see instructions for how to resolve the conflict in your local repository.

Last modified on Jul 7, 2023

Was this helpful?

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