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

Cannot merge one branch into another due to supposed conflicts

Krzysztof Kowalczyk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 14, 2023

I'm using GitFlow to develop an app. Every task has a feature/* branch and quick fixes have bugfix/* branches. Everything is merged to develop. No issues so far. Once every couple of weeks or so (let's say at the end of every sprint) I (and only I, other team members don't have access to merge) merge develop branch into staging branch. There is a pipeline for staging branch (the only branch with pipeline so far) running after every PR that updates staging server with latest changes from last sprint. Both develop and staging are blocked, you can't commit to those branches, you need to create a PR.

Few days ago I merged PR 132 (bugfix) into develop and then created PR 133 to merge develop into staging. Something was wrong with pipeline script, it couldn't rebuild Docker images on the server and failed after a long time. I created another bugfix and merged it in PR 134 into develop and then created PR 135 to merge develop into staging. This time pipeline didn't start because previous run exhausted all available minutes. Fair enough, didn't pay too much attention as I didn't need staging server updated at the time.

Today I finished working on a feature branch and merged PR 136 into develop. When I tried to merge develop into staging, it says staging is 3 commits behind and it needs to merge PR's 132, 134 (both should be part of staging branch) and 136 and it can't because there are conflicts. When I tried to do it the other way, it says develop is 2 commits behind staging and PR's 133 and 135 need to be merged (and there are conflicts). But PR's 133 and 135 were develop merge into staging...

At this point I'm completely lost. I can't do anything since staging can be updated by PR only and those supposed conflicts are Bitbucket trying to merge again what is already merged. I had such problem once in my life and couldn't figure out what and why (but there was a failed pipeline run before problems started so that might be a problem) and I ended up deleting and recreating staging branch with took quite a lot of time (since we are using staging branch on shared server) plus it costs me entire merge history (we are using squash). I would like to avoid that if possible.

1 answer

1 accepted

0 votes
Answer accepted
Erez Maadani
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.
February 14, 2023

Hey @Krzysztof Kowalczyk 

You can try the following:

  1. Create a new branch out of you dev branch: dev_helper
  2. Merge your staging branch into dev_helper.
  3. Resolve the conflicts in dev_helper and push back to the remote.
  4. Create a PR from dev_helper to dev.

Hope that helps

Krzysztof Kowalczyk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2023

I was kind of hoping that some would explain why and how it happened but thank you for providing steps to fix it.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events