Versions
- 9.6
- 9.5
- 9.4
- 9.3
- 9.2
- 9.1
- 9.0
- 8.19
- 8.18
- 8.17
- 8.16
- 8.15
- 8.14
- 8.13
- 8.12
- 8.11
- 8.10
- 8.9
- 8.8
- 8.7
- 8.6
- 8.5
- 8.4
- 8.3
- 8.2
- 8.1
- 8.0
- 7.21
- 7.20
- 7.18
- 7.19
- 7.17
- 7.16
- 7.15
- 7.14
- 7.13
- 7.12
- 7.11
- 7.10
- 7.9
- 7.8
- 7.7
- 7.6
- 7.5
- 7.4
- 7.3
- 7.2
- 7.1
- 7.0
- 6.10
- 6.9
- 6.8
- 6.7
- 6.6
- 6.5
- 6.4
- 6.3
- 6.2
- 6.1
- 6.0
- 5.16
- 5.15
- 5.14
- 5.13
- 5.12
- 5.11
- 5.10
- 5.9
- 5.8
- 5.7
- 5.6
- 5.5
- 5.4
- 5.3
- 5.2
- 5.1
- 5.0
- See all
Pull request merge strategies
Using pull requests in Bitbucket Server
On this page
Related content
- How to define a default merge strategy per Project
- Merge a pull request
- Remote merge is not happening in Bitbucket Server
- Bitbucket Server/Data Center shows diff between branches even after they are merged (using squash commit)
- Commits missing from Pull Request merge on target branch
- Automatic branch merging
- Understanding Diff view in Bitbucket Server
- Pull Request is automatically marked merged in Bitbucket Data Center and some of the code changes are lost on target branch after performing conflict resolution in a different branch
- Merging a pull request with 'rebase and fast-forward' strategy fails with merge conflict in Bitbucket Server
- Using forks in Bitbucket Server
Git merge strategies affect the way the Git history appears after a merge has occurred. With Bitbucket Server 4.9, repository admins can choose which merge strategies to allow, and set a default merge strategy. And users can now choose a merge strategy from the merge dialog of each pull request.
Prior to Bitbucket Server 4.9, you could choose a merge strategy within the configuration file, but you would have to use the same merge strategy for all pull requests within a repository. And, changing merge strategies required you to restart the instance, which could cause disruption to sysadmins and downtime for end-users.
The merge strategy options are:
Merge commit
--no-ff
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.
To configure merge strategies for a repository:
- In repository settings, select Pull requests.
- In the Merge strategy section, tick the box next to one or more merge strategies to determine which strategies are available to users when merging pull requests.
- Once an option is enabled you can set it as the default merge strategy for that repository by clicking Set as default.
To change the merge strategy for a specific pull request
- When merging a pull request, click the default merge strategy in use, then select a new one.
- Add a comment (if applicable), the click Merge.
Related content
- How to define a default merge strategy per Project
- Merge a pull request
- Remote merge is not happening in Bitbucket Server
- Bitbucket Server/Data Center shows diff between branches even after they are merged (using squash commit)
- Commits missing from Pull Request merge on target branch
- Automatic branch merging
- Understanding Diff view in Bitbucket Server
- Pull Request is automatically marked merged in Bitbucket Data Center and some of the code changes are lost on target branch after performing conflict resolution in a different branch
- Merging a pull request with 'rebase and fast-forward' strategy fails with merge conflict in Bitbucket Server
- Using forks in Bitbucket Server