{"thread":{"id":"19361","subject":"Rebase a whole tree from one commit to another?","startedAt":"2009-05-15T19:38:53Z","lastAt":"2009-05-16T13:49:06Z","messageCount":3,"participants":["Dirk Süsserott","Andreas Ericsson","Clemens Buchacher"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"114025","messageId":"4A0DC4CD.1030401@dirk.my1.cc","threadId":"19361","inReplyTo":null,"subject":"Rebase a whole tree from one commit to another?","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2009-05-15T19:38:53Z","receivedAt":"2009-05-15T19:38:53Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Hi alltogether.\n\nLet's say I have the following history:\n\n     | | | | branch-c\n     | | | |\n     | | |/  branch-b\n     | | |\n     | |/    branch-a\n     | |\n     |/\n     | master\n\nNow I checkout master, do some changes, and commit them to the master \nbranch. Let's call that new-master:\n\n    | new-master\n    | | | | | branch-c\n    | | | | |\n    | | | |/  branch-b\n    | | | |\n    | | |/    branch-a\n    | | |\n    | |/\n     \\| master\n\nI want to rebase my branches a, b, c to the new master. The clumsy way \nwould be:\n\n     git rebase new-master branch-a\n     git rebase branch-a   branch-b\n     git rebase branch-b   branch-c\n\nThe question is: Is there a way to rebase the whole tree (master -> \nbranch-a -> branch-b -> branch-c) from master to new-master with a \nsingle command?\n\n\nCheers\n   -- Dirk\n"},{"id":"114079","messageId":"4A0E6CC5.5090503@op5.se","threadId":"19361","inReplyTo":"4A0DC4CD.1030401@dirk.my1.cc","subject":"Re: Rebase a whole tree from one commit to another?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2009-05-16T07:35:33Z","receivedAt":"2009-05-16T07:35:33Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Dirk Süsserott wrote:\n> Hi alltogether.\n> \n> Let's say I have the following history:\n> \n>     | | | | branch-c\n>     | | | |\n>     | | |/  branch-b\n>     | | |\n>     | |/    branch-a\n>     | |\n>     |/\n>     | master\n> \n> Now I checkout master, do some changes, and commit them to the master \n> branch. Let's call that new-master:\n> \n>    | new-master\n>    | | | | | branch-c\n>    | | | | |\n>    | | | |/  branch-b\n>    | | | |\n>    | | |/    branch-a\n>    | | |\n>    | |/\n>     \\| master\n> \n> I want to rebase my branches a, b, c to the new master. The clumsy way \n> would be:\n> \n>     git rebase new-master branch-a\n>     git rebase branch-a   branch-b\n>     git rebase branch-b   branch-c\n> \n> The question is: Is there a way to rebase the whole tree (master -> \n> branch-a -> branch-b -> branch-c) from master to new-master with a \n> single command?\n> \n\nNo. You could merge all the branches that forked from master, rebase\nthe merged branch to new-master and then undo the merge-commit though,\nbut that would still mean three commands (and most likely some\nconflict resolution). Assuming you have (a lot) more than three\nbranches, this might be a way forward for you.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nRegister now for Nordic Meet on Nagios, June 3-4 in Stockholm\n http://nordicmeetonnagios.op5.org/\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"114099","messageId":"20090516134906.GA19110@localhost","threadId":"19361","inReplyTo":"4A0DC4CD.1030401@dirk.my1.cc","subject":"Re: Rebase a whole tree from one commit to another?","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-05-16T13:49:06Z","receivedAt":"2009-05-16T13:49:06Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Fri, May 15, 2009 at 09:38:53PM +0200, Dirk Süsserott wrote:\n>\n>     git rebase new-master branch-a\n>     git rebase branch-a   branch-b\n>     git rebase branch-b   branch-c\n>\n\nYou probably want something like\n\n\tgit rebase new-master branch-a\n\tgit rebase --onto branch-a branch-a@{1} branch-b\n\tgit rebase --onto branch-b branch-b@{1} branch-c\n\ninstead, because if you have any conflicts during rebase, the rebased\ncommits will no longer be recognized as identical, causing even more\nconflicts in the following rebases.\n"}]}