views:

2820

answers:

6

Is it possible to merge to a branch that is not a direct parent or child in TFS? I suspect that the answer is no as this is what I've experienced while using it. However, it seems that at certain times it would be really useful when there are different features being worked on that may have different approval cycles (ie. feature one might be approved before feature two). This becomes exceedingly difficult when we have production branches where we have to merge some feature into a previous branch so we can release before the next full version.

Our current branching strategy is to develop in the trunk (or mainline as we call it), and create a branch to stabilize and release to production. This branch can then be used to create hotfixes and other things while mainline can diverge for upcoming features.

What techniques can be used otherwise to mitigate a scenario such as the one(s) described above?

A: 

AFAIK you can do this as long as the branches were created off of the same original folder.

  • trunk/
  • branches/ -/feature1 (branched from trunk) -/feature2 (branched from trunk)

If you do this then you should be able to merge between feature1 and feature2 as well.

Though my branching/merging experience with TFS leaves me wanting more. I wish we just had SVN.

Ben Scheirman
+1  A: 

You may want to revisit your branching strategy. How do you get production branches? Are you merging all code from development branches, regression testing and then creating a production branch for fixes? Or are you developing on the trunk and then creating production branches to stabilize and release from? The second way creates problems of the type you're describing. If you are using the first approach -- the trunk is supposed to be only for things that have been built on branches tested and then merged you will run into this much less often. Under that approach if you're still having this problem it may be because your development effort is very large and you may need a relatively complex branching strategy with layers of branching and promotion.

Harpreet
+3  A: 
tf.exe merge /recursive /baseless $/TeamProject/SourceBranch $/TeamProject/TargetBranch
Mark Cidade
+1  A: 

Yes, you can do a baseless merge, but only from the command line (tf.exe).

Dan Shield
+1  A: 

TFS will allow you to merge with a branch that is not a parent/child - these are called baseless merges. See these links:

From MSDN

From the TFS Team via CodePlex

We typically do major or destabilizing changes on a development branch. If close to a major release of one of our products nearly all changes will be done on a branch.

Brian Stewart
+4  A: 

I agree with Harpeet that you may want to revisit how you you have setup you branching structure. However you if you really want to perform this type of merge you can through something called a baseless merge. It runs from the tfs command prompt,

Tf merge /baseless <<source path>> <<target path>> /recursive

Additional info about baseless merges can be found here

Also I found this document to be invaluable when constructing our tfs branching structure Microsoft Team Foundation Server Branching Guidance

Justin Dearing
Thanks, this helped me today.
Jeffrey Sharp