none
Merging From Branch to Branch

    Question

  • I have the following TFS source control layout:

    $/Main/
    $/Release 1.0.0.0
    $/Release 1.1.0.0
    $/Release 1.2.0.0
    ...
    etc

    Let's say I have a bug fix for version 1.0.0.0. I write the bug fix and check the code directly into $/Release 1.0.0.0.  I can label this changeset as  version 1.0.0.1 or branch it again or whatever.

    Let's say this particular bug applies to all releases and to my current Main. I can easily merge the change from $/Release 1.0.0.0 back into $/Main. No problem. But what if I want to merge that same change into 1.1.0.0 and 1.2.0.0?

    As far as I can tell, I first need to merge the change into $/Main and then back  out to the various release branches. There is no option to do a merge from one branch directly into another branch. Why is that?

    Furthermore, what happens if this particular bug fix no longer applies to $/Main? What if that component in question no longer exists, for instance? How do I then merge that change from $/Release 1.0.0.0 into the various other branches for which it does apply?
    Tuesday, August 08, 2006 2:30 PM

Answers

  • There is no option to do a merge from one branch directly into another branch. Why is that?

    The short answer is that TFS doesn't support indirect integrations. They tend to be unsafe -- depending on which files' common ancestors can be found in which branch at which time, automerge may or may not produce faulty file contents -- not to mention very slow. (In my opinion only
    one product has really gotten this feature right, and it took them a comprehensive multi-year redesign. We might support it in the future, though the need is lower since TFS has 1st-class renames.)

    What we do have are baseless merges. tf merge /baseless allows you to merge any two trees by essentially ignoring history. Using /baseless is even more dangerous, but at least you know what you're getting into up front
    .

    Furthermore, what happens if this particular bug fix no longer applies to $/Main? What if that component in question no longer exists, for instance?


    That's one of the dangers of your branching model. It looks like you're using something similar to
    example S1.2. Overlapping lines (example S3) would solve this, but of course that has its own trade-offs.

    You can workaround it using /baseless with the above caveats.

    Tuesday, August 08, 2006 10:27 PM

All replies

  • There is no option to do a merge from one branch directly into another branch. Why is that?

    The short answer is that TFS doesn't support indirect integrations. They tend to be unsafe -- depending on which files' common ancestors can be found in which branch at which time, automerge may or may not produce faulty file contents -- not to mention very slow. (In my opinion only
    one product has really gotten this feature right, and it took them a comprehensive multi-year redesign. We might support it in the future, though the need is lower since TFS has 1st-class renames.)

    What we do have are baseless merges. tf merge /baseless allows you to merge any two trees by essentially ignoring history. Using /baseless is even more dangerous, but at least you know what you're getting into up front
    .

    Furthermore, what happens if this particular bug fix no longer applies to $/Main? What if that component in question no longer exists, for instance?


    That's one of the dangers of your branching model. It looks like you're using something similar to
    example S1.2. Overlapping lines (example S3) would solve this, but of course that has its own trade-offs.

    You can workaround it using /baseless with the above caveats.

    Tuesday, August 08, 2006 10:27 PM
  • I am also interested in the same scenario.  However, by the time the bug fix is applied Main could be very different from 1.0.0.0.  In this case, can the changeset only (i.e. atomic changes) be applied to the other branches?

    I am confused on this.  Some feature listing posts for TFS say this is post while other posts in these forums suggest that ALL changes from Main would be propagated.  If this were the case, it would be difficult to have only  one mainline.
    Wednesday, August 09, 2006 3:57 PM
  • By the way - this is a Great paper!  Thanks for the link.

    http://www.cmcrossroads.com/bradapp/acme/branching/

     

    Wednesday, August 09, 2006 5:01 PM
  • DQM: yes, you can always cherry-pick individual changes at the changeset and/or file level.  However, the more dissimilar the 'base' and 'yours' versions are, the more likely the 3-way merge will require some manual work to get the results you want.
    Wednesday, August 09, 2006 6:16 PM
  • Thanks Richard.  I was wondering how an automatic merge would work in this case....this makes it clearer.
    Wednesday, August 09, 2006 8:22 PM