How do I create a branch on a TFS/Codeplex hosted project?

branch, codeplex, tfs, version-control

Solution

First, it may help to understand what a "Team Project" is - it's a logical entry in source control at the top-level of the source control tree, and is intended, typically, for a group of developers and various permissions and settings are set at this level. Within a Team Project, you can have multiple development projects such as Visual Studio solutions or Java projects. In this case, your team project is `$/WpfAnimatedGif`.

As for branching and merging, those occur below the Team Project level, typically as peers to your `trunk` or `main` branches. Various branching and merging strategies are covered in the TFS Branching and Merging Guide, but a simplified example for a Visual Studio solution called "WpfAnimatedGif" might have a branch strategy that looks like:

$/WpfAnimatedGif/main/WpfAnimatedGif
$/WpfAnimatedGif/branches/1.3/WpfAnimatedGif
$/WpfAnimatedGif/branches/test_features/WpfAnimatedGif

As for "best practices", they would be to create a `trunk` or `main` folder underneath the `$/WpfAnimatedGif` folder and move your VS projects beneath that. However, you could create a new folder for each branch and branch each project independently.

Eg:

`$/WpfAnimatedGif/WpfAnimatedGif` branched to `$/WpfAnimatedGif/branches/1.3/WpfAnimatedGif`

and

`$/WpfAnimatedGif/WpfAnimatedGif` branched to `$/WpfAnimatedGif/branches/1.3/WpfAnimatedGif.Demo`

However since these branches are independent, you would also have to then merge these two folders independently, instead of atomically from the `branches` folder.

Problem

Perhaps it's just because I'm not familiar with TFS (I've worked mostly with SVN), but I don't understand how to create a branch on a Codeplex hosted project. I'm using VS2012. In the Source Control Explorer, I select Branching and Merging > Branch... in the context menu, but then I don't know what to enter in the Target field: If I try `$/wpfanimatedgif/branches/1.3`, I get the following error: The target item $/wpfanimatedgif/branches/1.3 cannot be under the source item $/wpfanimatedgif. If I try `$/branches/1.3`, I get this error: TFS10198: Source control must branch into an existing team project. branches is not a team project. I also tried to create a new team project from Team Explorer, but I don't have the required permissions. So how can I create a branch? Or is it impossible to do it on a Codeplex project? BTW, the reason I want to create a branch is because I'm working on an experimental feature and I don't want to publish to the "trunk" (or whatever it's called in TFS). Perhaps TFS has a different way of handling this scenario? I know about shelving changes, but if I understand correctly, the shelved code won't be available on Codeplex, will it?

Original source