In TFS, we use a branching model which is pretty in-line with the normal branching models you’ll see out there. It looks like:
- $/
- branches
- releases
- 1.0
- 1.1
- trunk
- Database
- Managed
- Unmanaged
- Test
This morning I was trying to create a branch for a release we did over the weekend. I wanted to take the contents of trunk and branch it to $/releases/2.0. I already had a folder called 2.0 in the releases folder, so I right-clicked on trunk, chose the branch option, and chose $/releases/2.0 as the target, and then let it go.
What I ended up with was: $/releases/2.0/trunk. It branched the subfolder trunk under the releases folder. I undid the branch, and tried again. I tried many things before finally stumbling on the solution:
You can’t use an existing folder.
Yep. If you want to end up with $/releases/2.0/Database, $/releases/2.0/Managed, etc., you can’t use an existing folder. In other words, you right-click on the folder you want to branch:
Then pick the releases folder:
Which shows up in the dialog like:
Now, you have to type in the folder name you want to use. So, since in our example case it was 2.0, the dialog would now look like:
Note that if you already have a folder called 2.0, you’ll have to delete the folder (right-click, choose delete, and then check it in). This only works if you don’t already have an existing folder.
Once you do that, your branch will correctly look like:
- $/releases
- 2.0
- Database
- Managed
- etc
- 2.0
Thanks. I just spent an hour trying to figure out how to do just that.