git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* surprising behavior from merge
@ 2012-05-11 22:25 Sebastian Kuzminsky
  2012-05-11 23:57 ` Michael Witten
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Kuzminsky @ 2012-05-11 22:25 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-14 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 22:25 surprising behavior from merge Sebastian Kuzminsky
2012-05-11 23:57 ` Michael Witten
2012-05-12  0:05   ` Sebastian Kuzminsky
2012-05-12  2:25     ` Illia Bobyr
2012-05-14 18:14       ` Sebastian Kuzminsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).