1

When doing branches in tfs, does it matter if you are branching A to B or from B to A? The thing is that we have branch A and branch B, and now branch A has got messed up and we would like to recreate it from branch B by branching a new branch from B. As far as I know when you do a branch you get a relationship between the branches, but you don't get a "parent-child" relation, is that correct?

Is my question clear?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Tomas Jansson
  • 22,767
  • 13
  • 83
  • 137

1 Answers1

6

At the point where a new branch is constructed, it gets equal to what you chosen to branch out from.
The tricky point about TFS-merging (as opposed, for example to the P4 intergration, or ClearCase merges) is that at any given point merging A-->B & B-->A will not generate the equal amount of merge candidates.

Let's say branch A generates branch B:

------->A
         \
          \
           -----> B

Let's say you make changes in A:

------->A-->A'
         \
          \
           -----> B

If you try to merge A' --> B you will get as merge candidates all your changesets/source files that were changed from A-->A'.
But if you try to merge B --> A' you will get no merge candidates at all.

This behavior is regardless of fact that A is 'parent'.

If your 'A' is messed and cannot be rectifed with regular merge from B-->A, you have the following options:

  • Destroy A and generate a fresh copy of B in a new branch C
  • Rollback changes from A, until it reaches 'stable'
  • Perform a baseless merge from B-->A and force B-state on A

(Possible slightly off-topic, but an excellent read nevertheless - and valuable for my grasping of the TFS-way: This article by R.Banks)

Community
  • 1
  • 1
pantelif
  • 8,524
  • 2
  • 33
  • 48
  • Great answer. I had already done one of your suggestion. I deleted (not destroyed) my A branch and re-created it from my B branch. It all seems to work just fine. – Tomas Jansson Sep 22 '11 at 08:00