7

I'm cherry picking specific commits from a release branch into my local working copy. Every time I cherry-pick a commit from the release branch I get a merge conflict which I have to resolve, even with changes that seem trivial, such as:

-const char kApplicationVersion[] = "Develop";
+const char kApplicationVersion[] = "Release";

being the only change made in the commit to main.cc.

git status shows

You are currently cherry-picking commit 6f04be8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

    both modified:      src/appMain/main.cc

Why is there always a conflict?

JuJoDi
  • 14,627
  • 23
  • 80
  • 126

1 Answers1

3

Because since the two branches have diverged:

  • dev branch has modified the line with const char kApplicationVersion[] = "Develop";
  • rel branch has modified the line with const char kApplicationVersion[] = "Release";

A cherry-pick will resolve the merge against the common ancestor, but won't create an actual merge for that file (meaning the common ancestor remains a much older version, where dev branch started from release branch)

The next cherry-pick will consider the same old common ancestor and will trigger the same merge conflict.

See (much) more at "In a Git cherry-pick or rebase merge conflict, how are BASE (aka “the ancestor”), LOCAL, and REMOTE determined?"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250