TFS 2010 – Branching vs. Labeling
It's recommended you first read this article by “Microsoft Patterns and Practices” http://msdn.microsoft.com/en-us/library/bb668955.aspx
This article describes defining the branching and merging strategies that best suit your team. It explicitly says “Do not branch unless it becomes necessary for your development team. Branching introduces additional source tree maintenance and merging tasks.”
As more and more teams are moving towards Agile development, the rate at which they deliver has increased considerably. This results in multiple releases, probably more than one in a month.
If the teams start to maintain a branch for each release, the number of branches would exceed the number of directories you have in your source control at some point of time. Managing these many branches would be a nightmare.
However, if you don’t have branches you have no way to trace back to a previous version which you already released.
Labeling comes to the rescue here. TFS 2010 provides the ability to create Labels on a specific version. Every time you do a release, a Label can be created for the current version.
Lock the Branch
When you are ready to Release, lock the Main Branch so that no more check-ins are allowed.
Create a label for the Release version
Once the Main branch is locked, you can create a Label for the latest version.
Once the Label is created and you are ready to accept new changes from the Dev branch, you can then unlock the Main branch and allow check-ins to happen.
Get Specific version from a Label
In case you want to get the source for a specific Label, you can do it easily by getting a specific version specifying the label name.
Branch from a Label
In case you want to create a branch from a specific Label, you can do it easily by branching and specifying the label name.
This is how Labeling reduces the considerable effort required in managing branches for multiple releases.
**Known Issue
**Branch by label option is not available if you have already branched from that folder earlier, see http://connect.microsoft.com/VisualStudio/feedback/details/684885/branch-by-label-option-is-not-available-if-you-have-already-branched-from-that-folder-earlier
The workaround is to use the command line, e.g.
tf.exe branch oldSourceControlPath newSourceControlPath /version:LDemo_Release_1.0, seehttp://msdn.microsoft.com/en-us/library/d73s8b27(v=vs.80).aspx