{"thread":{"id":"36371","subject":"Changes based on a branch not yet merged back to master","startedAt":"2014-04-08T18:22:44Z","lastAt":"2014-04-08T19:53:09Z","messageCount":2,"participants":["K. Kwan","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"238547","messageId":"1396981364.85181.YahooMailNeo@web121903.mail.ne1.yahoo.com","threadId":"36371","inReplyTo":"1396956140.85747.YahooMailNeo@web121901.mail.ne1.yahoo.com","subject":"Changes based on a branch not yet merged back to master","fromName":"K. Kwan","fromEmail":"kkwansj_888@yahoo.com","sentAt":"2014-04-08T18:22:44Z","receivedAt":"2014-04-08T18:22:44Z","isPatch":false,"sender":{"key":"kkwansj_888@yahoo.com","avatar":null},"body":"\nI have a feature branch (A) containing changes awaiting code review. I now need to begin work on new feature (B) that is dependent on new files and changes made in branch (A).\n\n\nIs there \"proper\" way to rebase just the changes made in branch (B) back onto master (M) branch resulting from the merge of branch (A)\n\n\nMy tree would look like this:\n\n- x - x - x (master) \n\n       \\ x - x (A) x - x (B)\n\n\nBut after merge of branch (A), I would like it to look like this:\n\n- x - x - x ---- x (master)\n       \\        / \\\n        x - x (A)  x - x (B)\n\n\nPerhaps this?\n\n$ git checkout master\n$ git pull origin master\n$ git merge A\n$ git rebase --onto master A B\n\n\nRegards.\n"},{"id":"238562","messageId":"20140408195309.GA8461@sigill.intra.peff.net","threadId":"36371","inReplyTo":"1396981364.85181.YahooMailNeo@web121903.mail.ne1.yahoo.com","subject":"Re: Changes based on a branch not yet merged back to master","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-04-08T19:53:09Z","receivedAt":"2014-04-08T19:53:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 08, 2014 at 11:22:44AM -0700, K. Kwan wrote:\n\n> My tree would look like this:\n> \n> - x - x - x (master) \n> \n>        \\ x - x (A) x - x (B)\n> \n> \n> But after merge of branch (A), I would like it to look like this:\n> \n> - x - x - x ---- x (master)\n>        \\        / \\\n>         x - x (A)  x - x (B)\n> \n> \n> Perhaps this?\n> \n> $ git checkout master\n> $ git pull origin master\n> $ git merge A\n> $ git rebase --onto master A B\n\nYes, that should work. I think you could even just do:\n\n  git rebase master B\n\nsince after the merge, all of A is contained in master (and so will be\nomitted from the rebased commits).\n\n-Peff\n"}]}