Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-Branch merging in TFS?

Tags:

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?

like image 800
Joel Martinez Avatar asked Sep 09 '08 20:09

Joel Martinez


People also ask

How do I merge from one branch to another in TFS?

Choose Merge from Local to open the Source Control Merge Wizard: In the Source Control Merge Wizard, the Main branch is chosen automatically: Choose the latest version: Check Pending Changes/Included Changes.

How do I merge two projects in TFS?

Click the File menu, point to Source Control, point to Branching and Merging, and then click Merge. The Source Control Merge Wizard will displayed. 3.In the Target branch drop-down list, select the target team project branch to which you want to merge the source branch(first branch). 4.

How do I merge a branch to master TFS?

In order to merge branches, right click a database in the Object Explorer pane and from the More source control options sub-menu, select the Merge branches option: This initiates the Merge branches dialog: Browsing through a repository, source and target branches can be set.

How do I create a merge relationship in TFS?

You need to reparent the branch. You can do this under the "Branching and Merging" menu on the context-sensitive menu when you right click on a folder in the Source Control Explorer.


2 Answers

tf.exe merge /recursive /baseless $/TeamProject/SourceBranch $/TeamProject/TargetBranch
  • MSDN: How To: Perform a Baseless Merge in Visual Studio Team Foundation Server
like image 32
Mark Cidade Avatar answered Oct 26 '22 03:10

Mark Cidade


I agree with Harpreet 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

like image 171
Justin Dearing Avatar answered Oct 26 '22 04:10

Justin Dearing