Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Process for resolving merge conflict in a pull request (Bitbucket Server)

rshakespear March 8, 2018

I was attempting to merge a pull request from a feature branch into my develop branch. The merge failed with the error: Bitbucket cannot automatically merge this request due to conflicts.

The develop branch had some changes that were not merged into my feature branch, which caused this error to happen. 

I went to my local repository, and pulled the changes from the develop branch, and then merged the updated develop branch into my feature branch. I then pushed my feature branch out to the repository. This action didn't change anything with the pull request, and I was still unable to merge (same error message, even though the feature was fully caught up with develop).

Then, reading the help message better, I determined I needed to merge my feature into the develop branch on my local repository. I did this, and pushed the develop branch out. I expected the pull request to update as being merged, but there was no change. The only thing I could figure to do was to delete the pull request, since it was technically already merged. I don't want to have to delete pull requests, I would like to maintain a history of them.

My question is, where did I go wrong? I must have missed something, because I would have expected the pull request to update after both actions (merging updated develop into feature branch, or merging feature into updated develop).

1 comment

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2018

You can see the details steps here:

https://confluence.atlassian.com/bitbucket/resolve-merge-conflicts-704414003.html

In short, you resolve the merge conflict locally by checking out your feature branch and then merging the remote develop into it. You will have to resolve the conflicts, commit the merged code and push to the remote feature branch.

You can do the other way too, and it depends on your branching worklflow, but the PR should be automatically updated as merged. You don't have to delete it. If the PR is not getting updated, you are surely missing some step.

Like salim likes this
rshakespear March 8, 2018

Thanks for your response.

The difference in what you said vs what I did is that in my local repository I checked out the develop branch and then updated it to the latest from the remote develop branch. I then checked out my feature branch and merged the updated local develop branch into it. I then pushed the feature branch to the public repository, and the pull request did not change. Although more round-about, it seems like it ultimately did the same thing, but I'm not a GIT expert.

Now, if I understand correctly, if I had foregone updating my local develop and just updated my feature branch directly from the remote develop branch and then pushed that, it would have resolved the issue and updated the pull request?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2018

Hmm, no. Merging from remote develop is same as pulling develop to local and merging from local develop. And you should see the conflict locally when you do that. Hard to say what went wrong without knowing the exact sequence.

rshakespear March 8, 2018

The interesting thing was that there wasn't actually a conflict, only that develop was ahead of the feature branch. 

I will have to wait until this happens again and make sure I log the exact steps I take in case I run into the same problem.

Thanks for your time.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2018

huh, you shouldn't get that message for develop being ahead.

> Bitbucket cannot automatically merge this request due to conflicts.

Maybe your remote was ahead of local and that probably explains why you couldn't replicate the conflict locally. Make sure you pull all the changes before doing a merge locally.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events