{"thread":{"id":"28344","subject":"merge result","startedAt":"2011-09-09T10:54:21Z","lastAt":"2011-09-10T11:35:53Z","messageCount":6,"participants":["Lynn Lin","Andrew Ardill","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"175171","messageId":"CAPgpnMRrSmVrXD__jxv3uNrek8up+scHp+_Kj8+=HX8tfweWzQ@mail.gmail.com","threadId":"28344","inReplyTo":null,"subject":"merge result","fromName":"Lynn Lin","fromEmail":"lynn.xin.lin@gmail.com","sentAt":"2011-09-09T10:54:21Z","receivedAt":"2011-09-09T10:54:21Z","isPatch":false,"sender":{"key":"lynn.xin.lin@gmail.com","avatar":null},"body":"Hi All,\n   When I merge branch A back to master branch,if there are same\ncommit(developer do double commit) both in master and A branch, there\nwill be two same commit in master branch.For example\n\n\n   1->2->3-4>5        Master\n       |\n       4->6->7          A\n\nWhen I merge A branch into master,the two same 4 commit will present\nin master branch.\n\nIs there any wrong with my operation?\n\nThanks for your help\nLynn\n"},{"id":"175179","messageId":"CAH5451=BpiN9P8gjL5TYQO+NSH913oXo1-bmscMXyy8QhFg8KQ@mail.gmail.com","threadId":"28344","inReplyTo":"CAPgpnMRrSmVrXD__jxv3uNrek8up+scHp+_Kj8+=HX8tfweWzQ@mail.gmail.com","subject":"Re: merge result","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2011-09-09T12:41:15Z","receivedAt":"2011-09-09T12:41:15Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"Hi Lynn,\n\nIf you merge two branches together you are merging the state of the\nhead of those trees, not re-applying commits on top of each other. The\nchanges introduced in commit 4 will therefore not be applied twice,\nbut will more-or-less be ignored.\n\nPerhaps you are not trying a merge operation, but something else? Is\nthis issue hypothetical, or is it something you have experienced??\n\nRegards,\n\nAndrew Ardill\n\n\n\nOn 9 September 2011 20:54, Lynn Lin <lynn.xin.lin@gmail.com> wrote:\n> Hi All,\n>   When I merge branch A back to master branch,if there are same\n> commit(developer do double commit) both in master and A branch, there\n> will be two same commit in master branch.For example\n>\n>\n>   1->2->3-4>5        Master\n>       |\n>       4->6->7          A\n>\n> When I merge A branch into master,the two same 4 commit will present\n> in master branch.\n>\n> Is there any wrong with my operation?\n>\n> Thanks for your help\n> Lynn\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"175180","messageId":"vpqmxed6fby.fsf@bauges.imag.fr","threadId":"28344","inReplyTo":"CAPgpnMRrSmVrXD__jxv3uNrek8up+scHp+_Kj8+=HX8tfweWzQ@mail.gmail.com","subject":"Re: merge result","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-09T13:00:17Z","receivedAt":"2011-09-09T13:00:17Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Lynn Lin <lynn.xin.lin@gmail.com> writes:\n\n> Hi All,\n>    When I merge branch A back to master branch,if there are same\n> commit(developer do double commit) both in master and A branch, there\n> will be two same commit in master branch.\n\nThey cannot be the \"same\" commit. They are different commits (i.e.\ndifferent sha1 identifier, and probably different trees), even though\nthey may have the same commit message and represent the same diff.\n\n>    1->2->3-4>5        Master\n>        |\n>        4->6->7          A\n\nA more accurate drawing would be\n\n    1->2->3-4>5        Master\n        |\n        4'->6->7          A\n\nand after merging, you'd get\n\n    1->2->3-4>5-->8  A, master\n        |       /\n        4'->6->7\n\nwith 8 having both 4 and 4' as ancestors. There's nothing wrong with it.\nGit cannot remove either 4 or 4' without rewritting history, and \"git\nmerge\" does not rewrite history.\n\nIf you really really want to avoid this duplication in the history, then\nlearn about rebase (which is both powerfull and dangerous, you've been\nwarned).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"175253","messageId":"CAPgpnMTF4NEjPPXiBjRBG4yhDAdFpM0UM9kjBp7A06n=knfmmA@mail.gmail.com","threadId":"28344","inReplyTo":"CAH5451=BpiN9P8gjL5TYQO+NSH913oXo1-bmscMXyy8QhFg8KQ@mail.gmail.com","subject":"Re: merge result","fromName":"Lynn Lin","fromEmail":"lynn.xin.lin@gmail.com","sentAt":"2011-09-10T01:07:35Z","receivedAt":"2011-09-10T01:07:35Z","isPatch":false,"sender":{"key":"lynn.xin.lin@gmail.com","avatar":null},"body":"On Fri, Sep 9, 2011 at 8:41 PM, Andrew Ardill <andrew.ardill@gmail.com> wrote:\n> Hi Lynn,\n>\n> If you merge two branches together you are merging the state of the\n> head of those trees, not re-applying commits on top of each other. The\n> changes introduced in commit 4 will therefore not be applied twice,\n> but will more-or-less be ignored.\n>\n> Perhaps you are not trying a merge operation, but something else? Is\n> this issue hypothetical, or is it something you have experienced??\n\n\n1$ git checkout master\n2$ git edit  and commit\n3$ git checkout branchA\n4$ git edit and commit\n5$ git checkout master\n6 $ git merge branchA\n\n2 and 4 change is the same\n\n> Regards,\n>\n> Andrew Ardill\n>\n>\n>\n> On 9 September 2011 20:54, Lynn Lin <lynn.xin.lin@gmail.com> wrote:\n>> Hi All,\n>>   When I merge branch A back to master branch,if there are same\n>> commit(developer do double commit) both in master and A branch, there\n>> will be two same commit in master branch.For example\n>>\n>>\n>>   1->2->3-4>5        Master\n>>       |\n>>       4->6->7          A\n>>\n>> When I merge A branch into master,the two same 4 commit will present\n>> in master branch.\n>>\n>> Is there any wrong with my operation?\n>>\n>> Thanks for your help\n>> Lynn\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n>\n"},{"id":"175254","messageId":"CAPgpnMTMPQQPkS-gKLvUJNKLfMWuAT-oA3NCiSRFxu7PknYsnA@mail.gmail.com","threadId":"28344","inReplyTo":"vpqmxed6fby.fsf@bauges.imag.fr","subject":"Re: merge result","fromName":"Lynn Lin","fromEmail":"lynn.xin.lin@gmail.com","sentAt":"2011-09-10T01:11:42Z","receivedAt":"2011-09-10T01:11:42Z","isPatch":false,"sender":{"key":"lynn.xin.lin@gmail.com","avatar":null},"body":"On Fri, Sep 9, 2011 at 9:00 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Lynn Lin <lynn.xin.lin@gmail.com> writes:\n>\n>> Hi All,\n>>    When I merge branch A back to master branch,if there are same\n>> commit(developer do double commit) both in master and A branch, there\n>> will be two same commit in master branch.\n>\n> They cannot be the \"same\" commit. They are different commits (i.e.\n> different sha1 identifier, and probably different trees), even though\n> they may have the same commit message and represent the same diff.\n>\n>>    1->2->3-4>5        Master\n>>        |\n>>        4->6->7          A\n>\n> A more accurate drawing would be\n>\n>    1->2->3-4>5        Master\n>        |\n>        4'->6->7          A\n>\n> and after merging, you'd get\n>\n>    1->2->3-4>5-->8  A, master\n>        |       /\n>        4'->6->7\n>\n> with 8 having both 4 and 4' as ancestors. There's nothing wrong with it.\n> Git cannot remove either 4 or 4' without rewritting history, and \"git\n> merge\" does not rewrite history.\nso confused here.If 4' is just next 4 commit,how can the diff work? for example\n\n1->2->4->4'->6->...\n\n diff 4 and 4' is a little confused,correct?\n\n\nThanks for your time to explain here and teach me\n\n> If you really really want to avoid this duplication in the history, then\n> learn about rebase (which is both powerfull and dangerous, you've been\n> warned).\n>\n> --\n> Matthieu Moy\n> http://www-verimag.imag.fr/~moy/\n>\n"},{"id":"175274","messageId":"vpqr53oeijq.fsf@bauges.imag.fr","threadId":"28344","inReplyTo":"CAPgpnMTMPQQPkS-gKLvUJNKLfMWuAT-oA3NCiSRFxu7PknYsnA@mail.gmail.com","subject":"Re: merge result","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-09-10T11:35:53Z","receivedAt":"2011-09-10T11:35:53Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Lynn Lin <lynn.xin.lin@gmail.com> writes:\n\n>>>    1->2->3-4>5        Master\n>>>        |\n>>>        4->6->7          A\n>>\n>> A more accurate drawing would be\n>>\n>>    1->2->3-4>5        Master\n>>        |\n>>        4'->6->7          A\n>>\n>> and after merging, you'd get\n>>\n>>    1->2->3-4>5-->8  A, master\n>>        |       /\n>>        4'->6->7\n>>\n>> with 8 having both 4 and 4' as ancestors. There's nothing wrong with it.\n>> Git cannot remove either 4 or 4' without rewritting history, and \"git\n>> merge\" does not rewrite history.\n> so confused here.If 4' is just next 4 commit,how can the diff work? for example\n>\n> 1->2->4->4'->6->...\n>\n>  diff 4 and 4' is a little confused,correct?\n\nHistory is not linear. When you type \"git log\", you may think that 4 and\n4' follow each other, but try \"gitk\" or \"git log --oneline --graph\" to\nsee a better view of history.\n\nIt's possible to have several times the same change applied to multiple\nbranches (e.g. when doing cherry-picking), but having twice the same\nchange in a row is not really possible.\n\nSuppose your commit 4 removes the line \"foobar\". Then, commits 1, 2 and\n3 have the line \"foobar\" (think of commits as snapshots in history, not\nas diff. 3 is a snapshot, and when you run \"git show 3\", it shows you\nthe diff from 2 to 3). Commits 4 and 4' don't have it anymore, and then\nobviously 5, 6, 7 don't have it either. At the time of merge, Git will\nnotice that neither of the merges to commit have the line \"foobar\" and\nthe result 8 won't have it either.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}