Question about merge & cherry pick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I detect a potential issue with usage of merge and cherry pick.
I do a short script to reproduce my use case.
From my point of view, after these operations, content on branch master and dev should be same with "zZz" on second line and "eDe" on last one.
But it's not the case on second line...
I test the same thing with first commit on master, cherrypick on dev, second update on dev, merge dev on master, result is same. And I test to cherry pick second commit on master after final merge, cherry pick is ok and "fix" master content.
Can you help me to understand if it's normal or not ?

The script :
mkdir repo
cd repo

# Create a file and init 2 branches with same content
git init
echo -e "aAa\nzZz\nqQq\neEe" > file
git add .
git commit -a -m "init"
git checkout -b dev

# Update on dev
sed -i "s#Z#Y#" file
git commit -a -m "update"

# Cherrypick on master
git checkout master
git cherry-pick -x dev

# Second update on dev
git checkout dev
sed -i "s#Y#Z#" file
sed -i "s#E#D#" file
git commit -a -m "update that change second line as before first update and do another change"

# Merge on master
git checkout master
git merge dev --no-ff -m "Merge"

# Display result
echo
echo
echo MASTER
cat file
git checkout dev > /dev/null 2>&1
echo
echo DEV
cat file


Thanks




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux