Merge a pull request

Still need help?

The Atlassian Community is here for you.

Ask the community

Once you are ready to merge a pull request, and when the reviewers have approved it, click Merge at the top right of the pull request view. You can merge a pull request if you have write (or admin) permission on the project. 

Bitbucket 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 Server. 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.

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 Server and Git generate, and adds the text to the commit message for the merge.

Delete source branch after merging

Check Delete source branch after merging if you no longer need that branch in the repository. Bitbucket Server checks a few things before allowing the deletion – 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.
  • The branch is subject to an open pull request.

The Merge pull request dialog

Once accepted, the pull request is marked as merged on the Pull requests tab. If Bitbucket Server 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.

Choose a merge strategy

Git merge strategies affect the way the Git history appears after a merge has occurred. You can choose a merge strategy from the Merge pull request dialog. Administrators can configure which merge strategies are available and which merge strategy will be the default.

To change the merge strategy when merging a pull request, click the merge strategy in use (next to the Merge button), then select a new one. 

The merge strategies available in Bitbucket Server are:

  • Merge commit (--no-ffDEFAULT: Always create a new merge commit and update the target branch to it, even if the source branch is already up to date with the target branch.
  • Fast-forward (--ff): If the source branch is out of date with the target branch, create a merge commit. Otherwise, update the target branch to the latest commit on the source branch.
  • Squash (--squash): Combine all commits into one new non-merge commit on the target branch.
  • Fast-forward only (--ff-only): If the source branch is out of date with the target branch, reject the merge request. Otherwise, update the target branch to the latest commit on the source branch.
  • Squash, fast-forward only (--squash --ff-only): If the source branch is out of date with the target branch, reject the merge request. Otherwise, combine all commits into one new non-merge commit on the target branch.
Last modified on Jul 7, 2017

Was this helpful?

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