{"thread":{"id":"24411","subject":"Find successor of common ancestor","startedAt":"2010-07-16T08:29:37Z","lastAt":"2010-07-16T15:44:40Z","messageCount":7,"participants":["Enrico Weigelt","Santi Béjar","Johan Herland","Andreas Schwab","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"145672","messageId":"20100716082937.GA22894@nibiru.local","threadId":"24411","inReplyTo":null,"subject":"Find successor of common ancestor","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2010-07-16T08:29:37Z","receivedAt":"2010-07-16T08:29:37Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"\nHi folks,\n\n\nsuppose the following situation:\n\nI've forked some branch A into B, now A and B have evolved \nindependently for quite some time into A' and B'. Now I'd like\nto rebase B' along A' history line step by step - first on A+1, \nthen A+3, ... until A' (that's what I'd call zip-rebase).\n\nFor this I need to find out the successor commit A (along the A'\nhistory line). Does anyone know how to do that ?\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"},{"id":"145673","messageId":"AANLkTintIToGZu3fvK4aE5LFL7MgOnlfwKgsZ79Q0-o1@mail.gmail.com","threadId":"24411","inReplyTo":"20100716082937.GA22894@nibiru.local","subject":"Re: Find successor of common ancestor","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-07-16T08:49:45Z","receivedAt":"2010-07-16T08:49:45Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Jul 16, 2010 at 10:29 AM, Enrico Weigelt <weigelt@metux.de> wrote:\n>\n> Hi folks,\n>\n>\n> suppose the following situation:\n>\n> I've forked some branch A into B, now A and B have evolved\n> independently for quite some time into A' and B'. Now I'd like\n> to rebase B' along A' history line step by step - first on A+1,\n> then A+3, ... until A' (that's what I'd call zip-rebase).\n\nThis is just what \"git rebase\"  does:\n\n$ git checkout B'\n$ git rebase A'\n\nHTH,\nSanti\n"},{"id":"145676","messageId":"20100716090613.GB22894@nibiru.local","threadId":"24411","inReplyTo":"AANLkTintIToGZu3fvK4aE5LFL7MgOnlfwKgsZ79Q0-o1@mail.gmail.com","subject":"Re: Find successor of common ancestor","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2010-07-16T09:06:13Z","receivedAt":"2010-07-16T09:06:13Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"* Santi Béjar <santi@agolina.net> wrote:\n> On Fri, Jul 16, 2010 at 10:29 AM, Enrico Weigelt <weigelt@metux.de> wrote:\n> >\n> > Hi folks,\n> >\n> >\n> > suppose the following situation:\n> >\n> > I've forked some branch A into B, now A and B have evolved\n> > independently for quite some time into A' and B'. Now I'd like\n> > to rebase B' along A' history line step by step - first on A+1,\n> > then A+3, ... until A' (that's what I'd call zip-rebase).\n> \n> This is just what \"git rebase\"  does:\n> \n> $ git checkout B'\n> $ git rebase A'\n\nYes, but I need to find out A+1 for my zip-rebase.\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"},{"id":"145688","messageId":"201007161419.39469.johan@herland.net","threadId":"24411","inReplyTo":"20100716090613.GB22894@nibiru.local","subject":"Re: Find successor of common ancestor","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-07-16T12:19:39Z","receivedAt":"2010-07-16T12:19:39Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Friday 16 July 2010, Enrico Weigelt wrote:\n> * Santi Béjar <santi@agolina.net> wrote:\n> > On Fri, Jul 16, 2010 at 10:29 AM, Enrico Weigelt <weigelt@metux.de> \nwrote:\n> > > Hi folks,\n> > >\n> > >\n> > > suppose the following situation:\n> > >\n> > > I've forked some branch A into B, now A and B have evolved\n> > > independently for quite some time into A' and B'. Now I'd like\n> > > to rebase B' along A' history line step by step - first on A+1,\n> > > then A+3, ... until A' (that's what I'd call zip-rebase).\n> >\n> > This is just what \"git rebase\"  does:\n> >\n> > $ git checkout B'\n> > $ git rebase A'\n>\n> Yes, but I need to find out A+1 for my zip-rebase.\n\nIINM you have the following situation\n\nA0---A1---A2---A3---A4  <-- A'\n  \\\n   B1---B2---B3--B4  <-- B'\n\n...and you want to rebase B' (i.e. B1 through B4), first onto A1, then \nonto A2, the onto A3, and finally onto A4. I have no idea WHY you would \nwant to do this (rebasing directly onto A4 (like Santi suggests) is \nmuch cheaper), but you can certainly coax Git into doing it, anyway.\n\nTo list commits A1, A2, A3, A4 (in that order), do:\n\n  git rev-list --reverse B'..A'\n\nYou can now loop over the results like this:\n\n  git checkout B'\n  for a in $(git rev-list --reverse ..A'); do\n      git rebase $a\n  done\n\n\nHope this helps,\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"145689","messageId":"m2aaprr4ny.fsf@igel.home","threadId":"24411","inReplyTo":"20100716090613.GB22894@nibiru.local","subject":"Re: Find successor of common ancestor","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-07-16T12:29:21Z","receivedAt":"2010-07-16T12:29:21Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Enrico Weigelt <weigelt@metux.de> writes:\n\n> * Santi Béjar <santi@agolina.net> wrote:\n>> On Fri, Jul 16, 2010 at 10:29 AM, Enrico Weigelt <weigelt@metux.de> wrote:\n>> >\n>> > Hi folks,\n>> >\n>> >\n>> > suppose the following situation:\n>> >\n>> > I've forked some branch A into B, now A and B have evolved\n>> > independently for quite some time into A' and B'. Now I'd like\n>> > to rebase B' along A' history line step by step - first on A+1,\n>> > then A+3, ... until A' (that's what I'd call zip-rebase).\n>> \n>> This is just what \"git rebase\"  does:\n>> \n>> $ git checkout B'\n>> $ git rebase A'\n>\n> Yes, but I need to find out A+1 for my zip-rebase.\n\ngit rev-list [--first-parent] A..A' | tac |\nwhile read rev; do git rebase $rev; done\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":"145696","messageId":"20100716153544.GC22894@nibiru.local","threadId":"24411","inReplyTo":"201007161419.39469.johan@herland.net","subject":"Re: Find successor of common ancestor","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2010-07-16T15:35:44Z","receivedAt":"2010-07-16T15:35:44Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"* Johan Herland <johan@herland.net> wrote:\n\n> IINM you have the following situation\n> \n> A0---A1---A2---A3---A4  <-- A'\n>   \\\n>    B1---B2---B3--B4  <-- B'\n> \n> ...and you want to rebase B' (i.e. B1 through B4), first onto A1, then \n> onto A2, the onto A3, and finally onto A4. I have no idea WHY you would \n> want to do this (rebasing directly onto A4 (like Santi suggests) is \n> much cheaper), but you can certainly coax Git into doing it, anyway.\n\nIf the branches go off too far, you can easily end up in a lot of \nunresolvable conflicts, while on zip-rebase, there's great chance\nthat 3way-merge will catch this.\n\n> To list commits A1, A2, A3, A4 (in that order), do:\n> \n>   git rev-list --reverse B'..A'\n> \n> You can now loop over the results like this:\n> \n>   git checkout B'\n>   for a in $(git rev-list --reverse ..A'); do\n>       git rebase $a\n>   done\n\nThx, I'll have a try :)\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"},{"id":"145697","messageId":"AANLkTiloDCX4SuEDe_BNivv3UkY2TrQU1EAZlZGd1HYs@mail.gmail.com","threadId":"24411","inReplyTo":"20100716082937.GA22894@nibiru.local","subject":"Re: Find successor of common ancestor","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-07-16T15:44:40Z","receivedAt":"2010-07-16T15:44:40Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Jul 16, 2010 at 4:29 AM, Enrico Weigelt <weigelt@metux.de> wrote:\n> I've forked some branch A into B, now A and B have evolved\n> independently for quite some time into A' and B'. Now I'd like\n> to rebase B' along A' history line step by step - first on A+1,\n> then A+3, ... until A' (that's what I'd call zip-rebase).\n\nYou haven't *really* explained what you want to do here, but that\ndoesn't really effect the answer to your actual question...\n\n> For this I need to find out the successor commit A (along the A'\n> history line). Does anyone know how to do that ?\n\ngit rev-list --first-parent --reverse $(git merge-base A B)..A\n\nHave fun,\n\nAvery\n"}]}