I have simple test repository - just 1 file and several commits (creation of the repository is described at the end). I'm trying two variants of cherry-pick operations and I don't understand logic of conflict resolution:
If I do:
git cherry-pick test1
Git detects a conflict in string 1: 'change-1' <-> 'test-1'. It's clear.
If I do:
git cherry-pick test2
Git doesn't detect a conflict and makes a new commit! It seems string 'test-1' is lost in this case.
I wonder why doesn't Git detect a conflict in the second case?
Creation of the repository
1.At the beginning I have an empty repositiory and one text file test.txt with the following content:
delimiter
footer
2.
git add test.txt
git commit test.txt -m 'v1'
3. test.txt is changed:
change-1
delimiter
footer
4.
git add test.txt
git commit test.txt -m 'v2'
git branch main HEAD
5.
git checkout HEAD^
6. test.txt is changed:
test-1
delimiter
footer
7.
git add test.txt
git commit test.txt -m 'v1_1'
git tag test1 HEAD
8. test.txt is changed:
test-1
delimiter
test-2
footer
9.
git add test.txt
git commit test.txt -m 'v1_2'
git tag test2 HEAD
10.
git.exe checkout main
The reporitory will look like:
v1_2 (tag 'test2')
|
|
v1_1 (tag 'test1')
|
| v2 (branch 'main')
| |
v1--------
Then I do the first OR the second variant of cherry-pick.