Re: Question about merge & cherry pick

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

 



Ok, I didn't have this vision about how merge is apply, thanks.
There is no option to merge by considering each commit individually ?
Rebase do it but not applicable in my case :)
Thanks.

Le 07/11/2024 à 07:37, Johannes Sixt a écrit :
Am 06.11.24 um 21:24 schrieb Julien Maurel:
 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...
The behavior that you observe is as intended and not a bug.

You have this (consider each letter on its own line):

           A Z Q E       initial commit
          /       \
      A Y Q E      |     dev: Z -> Y
         |         |
         |     A Y Q E   master: cherry-pick Z -> Y
         |         |
      A Z Q D      |     dev: revert Y -> Z and change E -> D
          \        /
           A Y Q D       merge

Your expectation that the merge result is "A Z Q D" is wrong. Consider
what happened on the dev branch (left) since the branches diverged:
Since the change from Z to Y was reverted to Z, the only change that the
dev side contributes to the merge is that of E to D. The master side, on
the other hand, contributes the change of Z to Y. So the total of the
merge must be Z to Y from the master side and E to D from the dev side,
and that is what you get.

A merge does not consider the individual changes on the branches, but
only the differences since the merge base. For the merge operation, the
change from Z to Y never happened on the dev side. The reversal of Y to
Z is not visible for the merge and cannot contribute to the result.

-- Hannes






[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