Re: Branch Management questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 15, 2020 at 05:51:39AM -0400, Leam Hall wrote:

> 1. Two developers.
>   Dev A is working on Branch A, off a release_candidate branch.
>   Dev B is working on Branch B, off the same release_candidate branch.
>   Branches usually run 1-4 weeks.
>   Dev A does some work that would help Branch B.
>   How does Dev A get the Branch B work that is needed, in a
>     way that does not confuse the merge process at the end
>     of the release cycle?

If Dev A is OK getting _all_ of branch B, the best thing is to simply:

  git checkout branch-a
  git merge branch-b

That goes from:

  old -- a1 -- a2 -- a3   <-- branch-A
     \
      b1 -- b2 -- b3       <-- branch-B

to: 

  old -- a1 -- a2 -- a3 -- M  <-- branch-A
     \                    /
      b1 -- b2 -- b3 ----+    <-- branch-B

and then later when they merge again (either separately, or into
release_candidate), Git knows that "M" is the merge-base instead of
"old":

  old -- a1 -- a2 -- a3 -- M -- a4 -- a5 -- a6 <-- branch-A
     \                    /
      b1 -- b2 -- b3 ----+-- b4 -- b5 -- b6    <-- branch-B

If you need just parts of the work on b, then you'd probably have to
cherry-pick them. They should usually merge together cleanly eventually,
but if you further modify them (or touch nearby areas), that may result
in a conflict on merge into release_candidate.

> 2. One developer.
>   Working on Branch P, realizes that a new functionality X is
>     needed.
>   X isn't specific to Branch P, but critical to it.
>   What is the best way to deal with X, knowing that further work
>     on X will need to be done?

Create a new branch X for the shared topic, and base it not on P but on
whatever the fork point of P is (i.e., your release_candidate or
whatever). Then do some work on X, and merge X into P as needed.
Likewise for any other branch that builds on X.

If you've already built part of X on top of P, then you could
cherry-pick those parts onto the new branch X, and then either:

  - rebase P on top of X (which will drop the redundant bits)

  - merge X into P. You may have to resolve conflicts around the
    redundant parts, and you'll have some redundant commits left in the
    history (but the new merge will become the base for further merges
    between the branches)

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux