{"thread":{"id":"54425","subject":"Branch Management questions","startedAt":"2020-10-15T09:51:44Z","lastAt":"2020-10-15T19:57:57Z","messageCount":5,"participants":["Leam Hall","Konstantin Tokarev","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"407588","messageId":"595540a9-0000-8dcd-c555-3168d1b2d066@gmail.com","threadId":"54425","inReplyTo":null,"subject":"Branch Management questions","fromName":"Leam Hall","fromEmail":"leamhall@gmail.com","sentAt":"2020-10-15T09:51:39Z","receivedAt":"2020-10-15T09:51:44Z","isPatch":false,"sender":{"key":"leamhall@gmail.com","avatar":"https://gravatar.com/avatar/0c8d059b271ba6bf39bd832f0b95c954385219cf3a2906d26a5f35a94be63753?d=mp&s=160"},"body":"1. Two developers.\n   Dev A is working on Branch A, off a release_candidate branch.\n   Dev B is working on Branch B, off the same release_candidate branch.\n   Branches usually run 1-4 weeks.\n   Dev A does some work that would help Branch B.\n   How does Dev A get the Branch B work that is needed, in a\n     way that does not confuse the merge process at the end\n     of the release cycle?\n\n\n2. One developer.\n   Working on Branch P, realizes that a new functionality X is\n     needed.\n   X isn't specific to Branch P, but critical to it.\n   What is the best way to deal with X, knowing that further work\n     on X will need to be done?\n\n\n\n"},{"id":"407589","messageId":"2011231602755586@mail.yandex.ru","threadId":"54425","inReplyTo":"595540a9-0000-8dcd-c555-3168d1b2d066@gmail.com","subject":"Re: Branch Management questions","fromName":"Konstantin Tokarev","fromEmail":"annulen@yandex.ru","sentAt":"2020-10-15T09:55:17Z","receivedAt":"2020-10-15T10:01:06Z","isPatch":false,"sender":{"key":"annulen@yandex.ru","avatar":null},"body":"\n\n15.10.2020, 12:51, \"Leam Hall\" <leamhall@gmail.com>:\n> 1. Two developers.\n>    Dev A is working on Branch A, off a release_candidate branch.\n>    Dev B is working on Branch B, off the same release_candidate branch.\n>    Branches usually run 1-4 weeks.\n>    Dev A does some work that would help Branch B.\n>    How does Dev A get the Branch B work that is needed, in a\n>      way that does not confuse the merge process at the end\n>      of the release cycle?\n\nAvoid long-living branches and integrate atomic parts of work into base\nbranch as soon as it's done and reviewed.\n\n>\n> 2. One developer.\n>    Working on Branch P, realizes that a new functionality X is\n>      needed.\n>    X isn't specific to Branch P, but critical to it.\n>    What is the best way to deal with X, knowing that further work\n>      on X will need to be done?\n\nRebase P to the top of parent branch after X is integrated (see above).\n\n-- \nRegards,\nKonstantin\n"},{"id":"407591","messageId":"d10fd33c-3d5a-c5ed-c21c-6e6eff1a6351@gmail.com","threadId":"54425","inReplyTo":"2011231602755586@mail.yandex.ru","subject":"Re: Branch Management questions","fromName":"Leam Hall","fromEmail":"leamhall@gmail.com","sentAt":"2020-10-15T10:30:22Z","receivedAt":"2020-10-15T10:30:29Z","isPatch":false,"sender":{"key":"leamhall@gmail.com","avatar":"https://gravatar.com/avatar/0c8d059b271ba6bf39bd832f0b95c954385219cf3a2906d26a5f35a94be63753?d=mp&s=160"},"body":"On 10/15/20 5:55 AM, Konstantin Tokarev wrote:\n> \n> \n> 15.10.2020, 12:51, \"Leam Hall\" <leamhall@gmail.com>:\n>> 1. Two developers.\n>>     Dev A is working on Branch A, off a release_candidate branch.\n>>     Dev B is working on Branch B, off the same release_candidate branch.\n>>     Branches usually run 1-4 weeks.\n>>     Dev A does some work that would help Branch B.\n>>     How does Dev A get the Branch B work that is needed, in a\n>>       way that does not confuse the merge process at the end\n>>       of the release cycle?\n> \n> Avoid long-living branches and integrate atomic parts of work into base\n> branch as soon as it's done and reviewed.\n\nUnfortunately, for some tasks 1-4 weeks is atomic. The review process is \nbeing improved as well. We still need a way to integrate the \nlonger-lived branches cleanly. We've already had issues where attempts \nmeant lost code.\n\n\n>> 2. One developer.\n>>     Working on Branch P, realizes that a new functionality X is\n>>       needed.\n>>     X isn't specific to Branch P, but critical to it.\n>>     What is the best way to deal with X, knowing that further work\n>>       on X will need to be done?\n> \n> Rebase P to the top of parent branch after X is integrated (see above).\n\nAh, so \"Stop work on P, Resolve X, Rebase P from updated parent\"? Let me \ngo read up on that, it makes sense.\n\nThanks!\n\nLeam\n\n"},{"id":"407592","messageId":"1434961602758006@mail.yandex.ru","threadId":"54425","inReplyTo":"d10fd33c-3d5a-c5ed-c21c-6e6eff1a6351@gmail.com","subject":"Re: Branch Management questions","fromName":"Konstantin Tokarev","fromEmail":"annulen@yandex.ru","sentAt":"2020-10-15T10:39:55Z","receivedAt":"2020-10-15T10:40:01Z","isPatch":false,"sender":{"key":"annulen@yandex.ru","avatar":null},"body":"\n\n15.10.2020, 13:30, \"Leam Hall\" <leamhall@gmail.com>:\n> On 10/15/20 5:55 AM, Konstantin Tokarev wrote:\n>>  15.10.2020, 12:51, \"Leam Hall\" <leamhall@gmail.com>:\n>>>  1. Two developers.\n>>>      Dev A is working on Branch A, off a release_candidate branch.\n>>>      Dev B is working on Branch B, off the same release_candidate branch.\n>>>      Branches usually run 1-4 weeks.\n>>>      Dev A does some work that would help Branch B.\n>>>      How does Dev A get the Branch B work that is needed, in a\n>>>        way that does not confuse the merge process at the end\n>>>        of the release cycle?\n>>\n>>  Avoid long-living branches and integrate atomic parts of work into base\n>>  branch as soon as it's done and reviewed.\n>\n> Unfortunately, for some tasks 1-4 weeks is atomic. The review process is\n> being improved as well. We still need a way to integrate the\n> longer-lived branches cleanly. We've already had issues where attempts\n> meant lost code.\n>\n>>>  2. One developer.\n>>>      Working on Branch P, realizes that a new functionality X is\n>>>        needed.\n>>>      X isn't specific to Branch P, but critical to it.\n>>>      What is the best way to deal with X, knowing that further work\n>>>        on X will need to be done?\n>>\n>>  Rebase P to the top of parent branch after X is integrated (see above).\n>\n> Ah, so \"Stop work on P, Resolve X, Rebase P from updated parent\"? Let me\n> go read up on that, it makes sense.\n\nIf there are two developers, first working on X and and second working on P it may\nbe possible to reduce or avoid stopping second developer at the cost of possible\nadditional conflict resolution later.\n\n1. If X is close enough to finished state so it's API won't have big changes,\nyou cherry-pick X to P and continue work\n2. When X is finished and merged to parent branch, rebase P to updated parent\n3. If during rebase you hit conflict on patch X, just skip it (it's already in parent)\n4. If you hit conflicts in patches following X, you resolve them according to changes\ndone to X after you cherry-picked its intermediate revision.\n\n\n-- \nRegards,\nKonstantin\n"},{"id":"407672","messageId":"20201015195754.GD1490964@coredump.intra.peff.net","threadId":"54425","inReplyTo":"595540a9-0000-8dcd-c555-3168d1b2d066@gmail.com","subject":"Re: Branch Management questions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-10-15T19:57:54Z","receivedAt":"2020-10-15T19:57:57Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 15, 2020 at 05:51:39AM -0400, Leam Hall wrote:\n\n> 1. Two developers.\n>   Dev A is working on Branch A, off a release_candidate branch.\n>   Dev B is working on Branch B, off the same release_candidate branch.\n>   Branches usually run 1-4 weeks.\n>   Dev A does some work that would help Branch B.\n>   How does Dev A get the Branch B work that is needed, in a\n>     way that does not confuse the merge process at the end\n>     of the release cycle?\n\nIf Dev A is OK getting _all_ of branch B, the best thing is to simply:\n\n  git checkout branch-a\n  git merge branch-b\n\nThat goes from:\n\n  old -- a1 -- a2 -- a3   <-- branch-A\n     \\\n      b1 -- b2 -- b3       <-- branch-B\n\nto: \n\n  old -- a1 -- a2 -- a3 -- M  <-- branch-A\n     \\                    /\n      b1 -- b2 -- b3 ----+    <-- branch-B\n\nand then later when they merge again (either separately, or into\nrelease_candidate), Git knows that \"M\" is the merge-base instead of\n\"old\":\n\n  old -- a1 -- a2 -- a3 -- M -- a4 -- a5 -- a6 <-- branch-A\n     \\                    /\n      b1 -- b2 -- b3 ----+-- b4 -- b5 -- b6    <-- branch-B\n\nIf you need just parts of the work on b, then you'd probably have to\ncherry-pick them. They should usually merge together cleanly eventually,\nbut if you further modify them (or touch nearby areas), that may result\nin a conflict on merge into release_candidate.\n\n> 2. One developer.\n>   Working on Branch P, realizes that a new functionality X is\n>     needed.\n>   X isn't specific to Branch P, but critical to it.\n>   What is the best way to deal with X, knowing that further work\n>     on X will need to be done?\n\nCreate a new branch X for the shared topic, and base it not on P but on\nwhatever the fork point of P is (i.e., your release_candidate or\nwhatever). Then do some work on X, and merge X into P as needed.\nLikewise for any other branch that builds on X.\n\nIf you've already built part of X on top of P, then you could\ncherry-pick those parts onto the new branch X, and then either:\n\n  - rebase P on top of X (which will drop the redundant bits)\n\n  - merge X into P. You may have to resolve conflicts around the\n    redundant parts, and you'll have some redundant commits left in the\n    history (but the new merge will become the base for further merges\n    between the branches)\n\n-Peff\n"}]}