Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "Target" in TFS branching terminology?

Coming from a background with SVN and Mercurial/Git experience, I'm somewhat confuzzled by the terminology in TFS around branching. I'm trying to create a feature branch of a TFS Team Project by choosing the Branch... context menu option on the Team Project in the Source Control Explorer. It looks like this:

TFS branch popup

What does the "Target" mean here? Is that akin to the SVN-way of branching, where you indicate a path on the server? Is there a specific path for branches, or is it convention-based? I'm tempted to choose something like $/branches/MyProjectName/FeatureXYZ.

I've done some research to find out myself what "Target" means. I've clicked the ? top right and found this relevant msdn page, but the only relevant explanation I could find goes like this:

In the Target Branch Name box, specify the path of the new branch.

That doesn't help much. I had already assumed that it would be a path.

Furthermore, sharing my research so far, I've used my Google-Fu too but found no concise explanation. Finally, I've reviewed the suggested duplicates while writing this post as well as the similar questions, but found no answer.

Oh, and I've also tried entering $/MyProjectName/FeatureXYZ and clicking okay, but this presents an alert with this error:

The target item $/MyProjectName/FeatureXYZ cannot be under the source item $/MyProjectName.

Bottom line: what is a "Target" in TFS branching terminology, and how should I choose one?

like image 488
Jeroen Avatar asked Nov 17 '15 08:11

Jeroen


2 Answers

Ah. You are trying to branch a Team Project rather than a folder containing your code.

You should have your code in a folder, say "TRUNK", under the "$/TeamProject/" folder. You can then branch "$/TeamProject/TRUNK" to "$/TeamProject/Features/FeatureA".

If you have dumped all of your code into the root of your team project then you will need to move it into a folder first, then branch that folder.

warning: You can create a new team project that is a branch of this one, giving you "$/FeatureA". However this method is a terrible idea and will lead to pain and suffering

like image 114
MrHinsh - Martin Hinshelwood Avatar answered Oct 19 '22 01:10

MrHinsh - Martin Hinshelwood


You are right with your assumption on "Target" indicates a path on the server. But the root needs to be consistent: on your Team Project Collection, try : $/MyProjectName/FeatureXYZ. But your source needs to be a qualified "branch" first. So, either convert the Team Project to a branch [right click] or add a folder at that root level and convert it to a branch. Then you can safely branch from that branch. If you want to tidy up all branches on a subfolder try: $/MyProjectName/Branches/FeatureXYZ [assuming you have a branch $/MyProjectName/Main ...] i.e. the example on msdn

like image 29
demokritos Avatar answered Oct 19 '22 01:10

demokritos