gitazure-devopspull-requestcherry-pick

Encountered conflicts when cherry-picking commit . This operation needs to be performed locally error in Azure DevOps


I need to merge changes from one branch (this branch originated from the demo branch) let's say feature1FromDemo to another branch (beta).

There is a difference in the source code of the beta and demo branches, So I cannot raise a PR directly from feature1FromDemo to beta because it shows other changes as well.

So to merge only my changes I have thought to create PR only for my changes and cherry-pick that to the beta branch. So I have created a temporary branch from demo named feature1FromDemoTemp and raised PR to merge feature1FromDemo to feature1FromDemoTemp and then cherry-picked the changes.

It is giving the error .

Encountered conflicts when cherry-picking commit "00373b". This operation needs to be performed locally.

enter image description here

I have tried to cherry-pick this particular commit as well but still gives the same error.

So how to merge the changes I have made infeature1FromDemo the beta branch?


Solution

  • we suppose the only way is to edit your beta branch directly with the changes (on cloud or clone to local and modify).

    But I suppose that in your scenario you would need to avoid multiple merge base issue.

    One method is that you keep your merges among multiple branches on one-way, like demo->beta->master, or master->beta->demo.

    If cross-base could hardly be avoided in your developing, you could switch your merge type to Rebase and Fast-Forward.

    enter image description here

    I have dev and test branched from main. enter image description here

    After my merges from dev to test and dev to main with rebase and fast forward, the commit ids for the branches are still the same. enter image description here