surprising behavior from merge

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

 



Hi folks, I just ran in to a strange behavior with git merge.

Things start out with two branches (let's call them 'master' and 'other') pointing at a particular commit.  In master I commit a small one-line change, then make a second commit that adds some stuff just after the line changed in the previous commit.  In the other branch, i cherry-pick the second commit from master (the one that adds the new stuff).  The cherry-pick succeeds, despite the fuzzy context.  So far, so good.

Next I try to merge other into master.  I expected it to notice there was nothing to do and leave the master tree unchanged, but it applied the "add new stuff" patch to master (even though that patch is already in master) and made a commit from that.  So it silently did the wrong thing, and now the file contains two copies of stuff I added.

That is a simplified version of what happened, in my real repo there were several (unrelated and unimportant) commits on both master and the other branch.  When the surprising double-add happened, i simplified the repo to remove distractions.  The simplified repo is here if anyone wants to inspect it:  https://github.com/SebKuzminsky/merge-problem


-- 
Sebastian Kuzminsky

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]