Given that I have 3 commits in order
c1
+ print("A")
c2
+ print("B")
c3
+ print("C")
then I checkout a new branch at c1.
git checkout -b br c1
then I cherry-pick c3.
git cherry-pick c3.
what I want is the file has
print("A")
print("C")
-- I just pick c3 and c3 just add the line print("C")
but the fact is I got conflicts and the result is
print("A")
++<<<<<<< HEAD
++=======
+ print("B")
+ print("C")
++>>>>>>> f1383aa... C
my question are: 1. why conflicts? 2. what shall i do if I want print("A") and print("C")?
I also tried even I
git diff C^1 .. C > 1.patch
git apply 1.patch
I got
zhifan@zhifandeMacBook-Pro ~/g/demo> git apply 1.patch
error: patch failed: 1.py:1
error: 1.py: patch does not apply