{"thread":{"id":"37808","subject":"flatten-merge history","startedAt":"2014-10-25T12:31:53Z","lastAt":"2014-10-27T18:45:38Z","messageCount":7,"participants":["Henning Moll","Christian Couder","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"251040","messageId":"544B9839.7000302@gmx.de","threadId":"37808","inReplyTo":null,"subject":"flatten-merge history","fromName":"Henning Moll","fromEmail":"newsscott@gmx.de","sentAt":"2014-10-25T12:31:53Z","receivedAt":"2014-10-25T12:31:53Z","isPatch":false,"sender":{"key":"newsscott@gmx.de","avatar":null},"body":"Hi,\n\nsuppose the following history\n\n     P - - - Q - - - - - R       <-extern\n\nA -- - B - - - C - D - - - E   <-master\n          \\           \\\n           M ...       \\         <-b1\n                        \\\n                         W ...   <-b2\n\n\nNote that master and extern do not have a common parent. Both histories \nare 'distinct', they do not share common files, so there can't be any \nmerge conflicts. What i want to achieve is this history:\n\n     P - - - Q - - - - - R       <-extern\n\nA -P'- B'- Q'- C'- D'- R'- E'  <-master\n          \\           \\\n           M'...       \\         <-b1\n                        \\\n                         W'...   <-b2\n\nThe two histories should be merged in chronological order.\nSo while master reflects P-Q-R, b2 should only reflect P-Q and b1 should \nonly reflect P.\n\nAll my current attempts (surgery with git replace or interactive rebase \ncombined with merging) were not successfull.\n\nAny ideas?\n\nBest regards\nHenning\n"},{"id":"251054","messageId":"CAP8UFD3jyZ+7bk-xrE=TghzFj9UL=+Mtz-CvFWK9azNrRcOU5Q@mail.gmail.com","threadId":"37808","inReplyTo":"544B9839.7000302@gmx.de","subject":"Re: flatten-merge history","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-10-26T05:46:41Z","receivedAt":"2014-10-26T05:46:41Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Sat, Oct 25, 2014 at 2:31 PM, Henning Moll <newsScott@gmx.de> wrote:\n> Hi,\n>\n> suppose the following history\n>\n>     P - - - Q - - - - - R       <-extern\n>\n> A -- - B - - - C - D - - - E   <-master\n>           \\           \\\n>           M ...       \\         <-b1\n>                           \\\n>                           W ...   <-b2\n>\n>\n> Note that master and extern do not have a common parent. Both histories are\n> 'distinct', they do not share common files, so there can't be any merge\n> conflicts. What i want to achieve is this history:\n>\n>     P - - - Q - - - - - R       <-extern\n>\n> A -P'- B'- Q'- C'- D'- R'- E'  <-master\n>             \\           \\\n>             M'...       \\         <-b1\n>                             \\\n>                             W'...   <-b2\n>\n> The two histories should be merged in chronological order.\n> So while master reflects P-Q-R, b2 should only reflect P-Q and b1 should\n> only reflect P.\n>\n> All my current attempts (surgery with git replace or interactive rebase\n> combined with merging) were not successfull.\n\nCould you tell us why interactive rebase did not work?\nIf there can't be any merge conflict between both histories, it should\nhave worked without asking you to resolve any conflict.\n\nBest,\nChristian.\n"},{"id":"251059","messageId":"544D0702.1050907@gmx.de","threadId":"37808","inReplyTo":"CAP8UFD3jyZ+7bk-xrE=TghzFj9UL=+Mtz-CvFWK9azNrRcOU5Q@mail.gmail.com","subject":"Re: flatten-merge history","fromName":"Henning Moll","fromEmail":"newsscott@gmx.de","sentAt":"2014-10-26T14:36:50Z","receivedAt":"2014-10-26T14:36:50Z","isPatch":false,"sender":{"key":"newsscott@gmx.de","avatar":null},"body":"Am 26.10.2014 um 06:46 schrieb Christian Couder:\n> Hi,Could you tell us why interactive rebase did not work?\n\nFirst of all i have to admit that i did not i-rebase-merge, but \ni-rebase-cherrypick. Now i tried it with i-rebase-merge and it didn't \nwork either.\nHere's my workflow, which i repeated for all commits of 'extern' (in \nchronological order'). For simplicity let's assume that there is a \nparent commit for 'A'\n\n1. For P, A is the nearest prior commit on 'master'\n2. on master: git rebase -i A^\n3. change A from pick to edit. save. quit\n4. git merge P\n5. git rebase --continue\n\n From the perspective of 'master' this worked. But as all of the commits \nhave been rewritten, the branches b1 and b2 no longer refer to 'master'. \nBranch b2, for example, still branches off at B and not B'. So after \nthis action, my history looks like this:\n\n\n     P - - - Q - - - - - R       <-extern\n       \\\nA'- m - B'- - - C'- D'- - - E'  <-master\n\nA - - - B - - - C - D\n          \\           \\\n           M ...       \\         <-b1\n                        \\\n                         W ...   <-b2\n\nA and A' are nearly the same: they only differ in the new \nGIT_COMITTER_DATE.\nNow this is what i try to get (after only applying P):\n\n\n\n     P - - - Q - - - - - R       <-extern\n     \\\nA'- m - B'- - - C'- D'- - - E'  <-master\n          \\           \\\n           M'...       \\         <-b1\n                        \\\n                         W'...   <-b2\n\nRegards\nHenning\n"},{"id":"251060","messageId":"8761f65060.fsf@igel.home","threadId":"37808","inReplyTo":"544D0702.1050907@gmx.de","subject":"Re: flatten-merge history","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2014-10-26T15:19:03Z","receivedAt":"2014-10-26T15:19:03Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Henning Moll <newsScott@gmx.de> writes:\n\n> 1. For P, A is the nearest prior commit on 'master'\n> 2. on master: git rebase -i A^\n> 3. change A from pick to edit. save. quit\n> 4. git merge P\n> 5. git rebase --continue\n>\n> From the perspective of 'master' this worked. But as all of the commits\n> have been rewritten, the branches b1 and b2 no longer refer to\n> 'master'. Branch b2, for example, still branches off at B and not B'.\n\nYou only rebased master, so b1 and b2 were unchanged.  If you want to\nchange b1 and b2 you have to rebase them as well.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"251073","messageId":"CAP8UFD2yjXC6ffCQyTvYNZZ00Ou=YmNgyWxGhbO29nbTHXRD5w@mail.gmail.com","threadId":"37808","inReplyTo":"8761f65060.fsf@igel.home","subject":"Re: flatten-merge history","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-10-26T19:02:15Z","receivedAt":"2014-10-26T19:02:15Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Oct 26, 2014 at 4:19 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Henning Moll <newsScott@gmx.de> writes:\n>\n>> 1. For P, A is the nearest prior commit on 'master'\n>> 2. on master: git rebase -i A^\n>> 3. change A from pick to edit. save. quit\n>> 4. git merge P\n>> 5. git rebase --continue\n>>\n>> From the perspective of 'master' this worked. But as all of the commits\n>> have been rewritten, the branches b1 and b2 no longer refer to\n>> 'master'. Branch b2, for example, still branches off at B and not B'.\n>\n> You only rebased master, so b1 and b2 were unchanged.  If you want to\n> change b1 and b2 you have to rebase them as well.\n\nYeah. Henning, when interactively rebasing, in our editor, you should\nhave something like:\n\npick A\npick P\npick B\npick Q\npick C\npick D\npick R\npick E\n\nwhich should work without any conflict.\nAnd then you can rebase the b1 and b2 branches on the resulting branch.\n\nBest,\nChristian.\n"},{"id":"251076","messageId":"544D878D.6020809@gmx.de","threadId":"37808","inReplyTo":"CAP8UFD2yjXC6ffCQyTvYNZZ00Ou=YmNgyWxGhbO29nbTHXRD5w@mail.gmail.com","subject":"Re: flatten-merge history","fromName":"Henning Moll","fromEmail":"newsscott@gmx.de","sentAt":"2014-10-26T23:45:17Z","receivedAt":"2014-10-26T23:45:17Z","isPatch":false,"sender":{"key":"newsscott@gmx.de","avatar":null},"body":"Am 26.10.2014 um 20:02 schrieb Christian Couder:\n> Yeah. Henning, when interactively rebasing, in our editor, you should \n> have something like: pick A pick P pick B pick Q pick C pick D pick R \n> pick E which should work without any conflict. And then you can rebase \n> the b1 and b2 branches on the resulting branch.\n\nThank you all very much. It worked!\n\nI didn't know that i could also introduce new commits in the interactive \nrebase list. Just for the record, in case others need to do such a task:\n\nintial situation:\n\n     P - - - Q - - - - - R       <-extern\n\nA - - - B - - - C - D - - - E   <-master\n          \\           \\\n           M ...       \\         <-b1\n                        \\\n                         W ...   <-b2\n\nOn master:\n$ git rebase -i --root\n\n(editor opens showing\n\npick A\npick B\npick C\npick D\npick E\n\nmodify this to\n\npick A\npick P\npick B\npick Q\npick C\npick D\npick R\npick E\n\nsave, quit. Now, master is already fixed. Now fix the branches:\n\n$ git rebase --onto B' B b1\n$ git rebase --onto D' D b2\n\nJust a final question: Is it possible to keep the GIT_COMMITTER_DATE in \nall those rebases?\n\nThanks again\nHenning\n"},{"id":"251126","messageId":"874mupbbcd.fsf@igel.home","threadId":"37808","inReplyTo":"544D878D.6020809@gmx.de","subject":"Re: flatten-merge history","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2014-10-27T18:45:38Z","receivedAt":"2014-10-27T18:45:38Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Henning Moll <newsScott@gmx.de> writes:\n\n> Just a final question: Is it possible to keep the GIT_COMMITTER_DATE in\n> all those rebases?\n\nIf you want that you need to work with git filter-branch.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}