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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

You can see the details steps here:

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.

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?

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.

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.

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.


Log in or Sign up to comment
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

170 views 0 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you