- When trying to merge a pull request via a pull request, the user receives an error about merge conflicts even though there are no conflicts and automatic merging works in a local clone
- The latest commits to the source branch are not visible in the pull request. The pull request is only showing commits made up to when the PR was first opened, or else the pull request is simply not showing the most recent commits
Specifically, the following line in the above merge exception is indicative of this issue:
The pull request is not up to date with the tip of the source branch, or the tip of the target branch.
When new commits are made to the source or the target, the pull request should be rescoped - in other words, recalculated to test whether the PR will be successful against the current state of both the source and the target. Under some rare circumstances, this rescoping might not have happened, meaning that the pull request is out of sync with the state of the source or target branches, and so attempting to merge from the PR will fail.
There are a couple of reasons for this to occur:
- New commits being received to branches, and the rescoping of PR's to include the latest commits, is inherently subject to race conditions. Whilst this is a rare occurrence it is possible on very busy repositories for this to happen. Normally this should resolve itself.
- On a clustered instance, where all nodes use Hazelcast to share objects in memory, there are some edge case scenarios where Hazelcast objects may fail to be kept up to date.
- Wait a minute to allow the PR to be rescoped, then refresh the page and retry merging the PR
- Decline the PR and reopen it to force the PR to be rescoped manually, then merge it
- Restart Bitbucket Server. On a clustered instance, a full cluster shutdown needs to be performed (so all nodes are shut down before restarting any). You should only try this if the issue occurs repeatedly and the above workarounds are not working.