{"thread":{"id":"17962","subject":"Git rebase aggravation","startedAt":"2009-02-23T04:20:10Z","lastAt":"2009-02-23T09:34:04Z","messageCount":3,"participants":["Myxz Ptlk","Nazri Ramliy","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"105840","messageId":"22155203.post@talk.nabble.com","threadId":"17962","inReplyTo":null,"subject":"Git rebase aggravation","fromName":"Myxz Ptlk","fromEmail":"adrian.klingel@illumaware.com","sentAt":"2009-02-23T04:20:10Z","receivedAt":"2009-02-23T04:20:10Z","isPatch":false,"sender":{"key":"adrian.klingel@illumaware.com","avatar":null},"body":"\nI have two branches that diverged a long time ago, master and zoo.  I work\nlocally and check changes into a remote repository.  The remote repository\nis also set up the same, and the local branches are set up to track the\nremote branches.  Major development has gone on in both sides unfortunately. \n\"master\" is the production version.  My strategy to get the two together\nwas:\n\n1)  Rebase master into zoo.\n\n2) Merge zoo into master.\n\nBut here is what happens.  I spend 3 hours inside \"zoo\" doing \"git rebase\nmaster\".  I go through all the hell of reconciling 6 months of development. \nThen at the end, it just says that the commits now differ between local\n\"zoo\" and \"origin/zoo\".\n\nSo I figure, I will pull from \"origin/zoo\".  Naturally, that results in a\nconflicted merge, which I then clear up.  I commit the merge, then push\neverything back to the remote branch.\n\nNow I would guess that my \"zoo\" branch has everything in it from \"master\",\nand it is also in sync with the  \"origin/zoo\" branch.  I push and pull and\nverify that this is so.\n\nMy thinking is that if I were to attempt a new rebase of master, the\nbeginning of what would be rebased would start from RIGHT NOW, instead of\nall the commits over the past 6 months.  To check this, I type:\n\ngit rebase master\n\nfrom \"zoo\".  Lo and behold, it starts the whole process over again.  I \"git\nrebase --abort\", but I am very, very confused.\n\nWhy does the rebase not remember all the freaking work I just did?  Why\nwould I have to rebase the same commits all over again?  How do people keep\ndownstream branches up to date if this doesn't work?  What am I missing\nhere?  I will be extremely grateful for any help and understanding anybody\ncan offer.\n-- \nView this message in context: http://www.nabble.com/Git-rebase-aggravation-tp22155203p22155203.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"105842","messageId":"544dda350902222034x6c9a0118sd6a96dc2575396ed@mail.gmail.com","threadId":"17962","inReplyTo":"22155203.post@talk.nabble.com","subject":"Re: Git rebase aggravation","fromName":"Nazri Ramliy","fromEmail":"ayiehere@gmail.com","sentAt":"2009-02-23T04:34:22Z","receivedAt":"2009-02-23T04:34:22Z","isPatch":false,"sender":{"key":"ayiehere@gmail.com","avatar":"https://avatars.githubusercontent.com/u/164756?v=4"},"body":"See git help rerere.\n\nIt's not enabled by default.\n\nnazri.\n"},{"id":"105890","messageId":"200902231034.08736.trast@student.ethz.ch","threadId":"17962","inReplyTo":"22155203.post@talk.nabble.com","subject":"Re: Git rebase aggravation","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-02-23T09:34:04Z","receivedAt":"2009-02-23T09:34:04Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Myxz Ptlk wrote:\n> 1)  Rebase master into zoo.\n> \n> 2) Merge zoo into master.\n\nYou may want to consider a merge and topic branch based workflow.  man\ngitworkflows has some pointers.\n\nFor the rest of the discussion let's assume that your history looks\nlike\n\n  *---*---*---*  (master)\n   \\\n    \\\n     o---o---o   (zoo = origin/zoo)\n\nSince you have tracking branches, origin/zoo should be the same as\nzoo.  (origin/master should exist too but isn't important for now.)\n\n> But here is what happens.  I spend 3 hours inside \"zoo\" doing \"git rebase\n> master\".  I go through all the hell of reconciling 6 months of development. \n> Then at the end, it just says that the commits now differ between local\n> \"zoo\" and \"origin/zoo\".\n\nIndeed, since you rewrote every commit on zoo, it now looks like\n\n  *---*---*---*   (master)\n  |            \\                 \n  |             \\                \n  \\              o'--o'--o'   (zoo)\n   \\\n    o---o---o  (origin/zoo)\n\n> So I figure, I will pull from \"origin/zoo\".  Naturally, that results in a\n> conflicted merge, which I then clear up.  I commit the merge, then push\n> everything back to the remote branch.\n\nYou're merging like this:\n\n  *---*---*---*   (master)\n  |            \\                 \n  |             \\                \n  \\              o'--o'--o'---M   (zoo)\n   \\                         /\n    o---o---o---------------'\n              (origin/zoo)\n\n\nI think you can already see that you made a mess of history :-)\n\nYou should have forced the push instead.  But see \"recovering from\nupstream rebase\" in man git-rebase for information on what happens to\neveryone else's work that was based on zoo.\n\n> My thinking is that if I were to attempt a new rebase of master, the\n> beginning of what would be rebased would start from RIGHT NOW, instead of\n> all the commits over the past 6 months.  To check this, I type:\n> \n> git rebase master\n> \n> from \"zoo\".  Lo and behold, it starts the whole process over again.  I \"git\n> rebase --abort\", but I am very, very confused.\n\nActually it's even worse: it should attempt to rebase _every_ commit\nin master..zoo.  If master has progressed since your original\nrebase+merge, this will be both the \"o\" and \"o'\" commits above.\n\n(Except the ones that did not conflict at all, since they'll still be\nthe same.)\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}