{"thread":{"id":"16533","subject":"Is rebase always destructive?","startedAt":"2008-12-01T11:41:39Z","lastAt":"2008-12-01T20:19:03Z","messageCount":6,"participants":["Csaba Henk","Johan Herland","Nick Andrew","Andreas Ericsson","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96829","messageId":"slrngj7jch.2srb.csaba-ml@beastie.creo.hu","threadId":"16533","inReplyTo":null,"subject":"Is rebase always destructive?","fromName":"Csaba Henk","fromEmail":"csaba-ml@creo.hu","sentAt":"2008-12-01T11:41:39Z","receivedAt":"2008-12-01T11:41:39Z","isPatch":false,"sender":{"key":"csaba-ml@creo.hu","avatar":null},"body":"Hi,\n\nWhen doing a rebase, I can find a number of reasons for which one might\nfeel like to preserve the rebased branch (that is, perform an operation\nwhich copies the branch over a new base, not moves).\n\n-  For example, a successful rebase doesn't necessarily mean that the\n   code, as of the rebased branch, is consistent and compiles. That is,\n   the rebase can be broken even if git can put things together diff-wise.\n   In such a case I wouldn't be happy to lose the original instance of\n   the branch.\n\n-  Or I might want to build different versions of the program, and each\n   version of it needs a given set of fixes (the same one). Then rebasing\n   my bugfix branch is not a good idea, I'd much rather copy it over all\n   those versions.\n\nI can't see any option for rebase which would yield this cp-like\nbehaviour. Am I missing something? Or people don't need such a feature?\n(Then give me some LART please, my mind is not yet gittified enough to\nsee why is this not needed.) Or is it usually done by other means, not\nrebase?\n\nThanks\nCsaba\n"},{"id":"96832","messageId":"200812011254.36109.johan@herland.net","threadId":"16533","inReplyTo":"slrngj7jch.2srb.csaba-ml@beastie.creo.hu","subject":"Re: Is rebase always destructive?","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-12-01T11:54:35Z","receivedAt":"2008-12-01T11:54:35Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 01 December 2008, Csaba Henk wrote:\n> Hi,\n>\n> When doing a rebase, I can find a number of reasons for which one\n> might feel like to preserve the rebased branch (that is, perform an\n> operation which copies the branch over a new base, not moves).\n>\n> -  For example, a successful rebase doesn't necessarily mean that the\n>    code, as of the rebased branch, is consistent and compiles. That\n> is, the rebase can be broken even if git can put things together\n> diff-wise. In such a case I wouldn't be happy to lose the original\n> instance of the branch.\n>\n> -  Or I might want to build different versions of the program, and\n> each version of it needs a given set of fixes (the same one). Then\n> rebasing my bugfix branch is not a good idea, I'd much rather copy it\n> over all those versions.\n>\n> I can't see any option for rebase which would yield this cp-like\n> behaviour. Am I missing something? Or people don't need such a\n> feature? (Then give me some LART please, my mind is not yet gittified\n> enough to see why is this not needed.) Or is it usually done by other\n> means, not rebase?\n\nThe operation you refer to as \"cp-like\" rebase behaviour is equivalent \nto cherry-picking a range of commits. The latter has been discussed \nextensively on this list, although I'm not sure any conclusion has been \nreached.\n\nI would also very much like to have this operation available in either \nform (\"git rebase --copy\" or \"git cherry-pick from..to\"), although I'd \nprobably prefer the \"git cherry-pick from..to\" form.\n\n\nHave fun! :)\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"96836","messageId":"20081201121140.GB32415@mail.local.tull.net","threadId":"16533","inReplyTo":"slrngj7jch.2srb.csaba-ml@beastie.creo.hu","subject":"Re: Is rebase always destructive?","fromName":"Nick Andrew","fromEmail":"nick@nick-andrew.net","sentAt":"2008-12-01T12:11:40Z","receivedAt":"2008-12-01T12:11:40Z","isPatch":false,"sender":{"key":"nick@nick-andrew.net","avatar":"https://gravatar.com/avatar/85f25a67ca6eaa4016ed374f6d07f3cd853c886aeb7e1507eb7dbc47b00082fe?d=mp&s=160"},"body":"On Mon, Dec 01, 2008 at 11:41:39AM +0000, Csaba Henk wrote:\n> When doing a rebase, I can find a number of reasons for which one might\n> feel like to preserve the rebased branch (that is, perform an operation\n> which copies the branch over a new base, not moves).\n\n[...]\n\n> I can't see any option for rebase which would yield this cp-like\n> behaviour. Am I missing something?\n\nHow about this:\n\ngit checkout topic\ngit branch keepme\ngit rebase master\n\nYour 'topic' branch will now be rebased against master, and due\nto the 'keepme' branch pointer at the original topic HEAD, you can\nsee the original commits before rebasing.\n\nNick.\n"},{"id":"96870","messageId":"49341494.40907@op5.se","threadId":"16533","inReplyTo":"slrngj7jch.2srb.csaba-ml@beastie.creo.hu","subject":"Re: Is rebase always destructive?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-12-01T16:45:08Z","receivedAt":"2008-12-01T16:45:08Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Csaba Henk wrote:\n> Hi,\n> \n> When doing a rebase, I can find a number of reasons for which one might\n> feel like to preserve the rebased branch (that is, perform an operation\n> which copies the branch over a new base, not moves).\n> \n> -  For example, a successful rebase doesn't necessarily mean that the\n>    code, as of the rebased branch, is consistent and compiles. That is,\n>    the rebase can be broken even if git can put things together diff-wise.\n>    In such a case I wouldn't be happy to lose the original instance of\n>    the branch.\n> \n> -  Or I might want to build different versions of the program, and each\n>    version of it needs a given set of fixes (the same one). Then rebasing\n>    my bugfix branch is not a good idea, I'd much rather copy it over all\n>    those versions.\n> \n> I can't see any option for rebase which would yield this cp-like\n> behaviour. Am I missing something? Or people don't need such a feature?\n> (Then give me some LART please, my mind is not yet gittified enough to\n> see why is this not needed.) Or is it usually done by other means, not\n> rebase?\n> \n\nWhen I feel I'm in any danger of ending up with mis-compiles or whatnot,\nI usually do\n  git checkout -b try-rebase\n  git rebase $target\nwhich does exactly what you want.\n\nFor almost all other operations, it's possible to get your previous\nbranch-pointer back, either by referencing ORIG_HEAD, or the reflogs.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"96877","messageId":"slrngj8884.2srb.csaba-ml@beastie.creo.hu","threadId":"16533","inReplyTo":"20081201121140.GB32415@mail.local.tull.net","subject":"Re: Is rebase always destructive?","fromName":"Csaba Henk","fromEmail":"csaba-ml@creo.hu","sentAt":"2008-12-01T17:37:43Z","receivedAt":"2008-12-01T17:37:43Z","isPatch":false,"sender":{"key":"csaba-ml@creo.hu","avatar":null},"body":"On 2008-12-01, Nick Andrew <nick@nick-andrew.net> wrote:\n> On Mon, Dec 01, 2008 at 11:41:39AM +0000, Csaba Henk wrote:\n>> I can't see any option for rebase which would yield this cp-like\n>> behaviour. Am I missing something?\n>\n> How about this:\n>\n> git checkout topic\n> git branch keepme\n> git rebase master\n\nOK, thanks guys, now I'm enlightened (a little bit more than before).\n\nRegards,\nCsaba\n"},{"id":"96888","messageId":"200812012119.03372.robin.rosenberg.lists@dewire.com","threadId":"16533","inReplyTo":"slrngj8884.2srb.csaba-ml@beastie.creo.hu","subject":"Re: Is rebase always destructive?","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-12-01T20:19:03Z","receivedAt":"2008-12-01T20:19:03Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"måndag 01 december 2008 18:37:43 skrev Csaba Henk:\n> On 2008-12-01, Nick Andrew <nick@nick-andrew.net> wrote:\n> > On Mon, Dec 01, 2008 at 11:41:39AM +0000, Csaba Henk wrote:\n> >> I can't see any option for rebase which would yield this cp-like\n> >> behaviour. Am I missing something?\n> >\n> > How about this:\n> >\n> > git checkout topic\n> > git branch keepme\n> > git rebase master\n> \n> OK, thanks guys, now I'm enlightened (a little bit more than before).\n\nAnd if you forgot to create the keepme branch you can access the previous\nversion using the topic@{1} or topic@{'1 hour ago'} etc. This uses the reflog\nthat tracks all \"versions\" of your branch. Keeping gitk running is nice way\nto see previous versions (press F5 after rebase).\n\n-- robin\n"}]}