When to use a Tag/Label and when to branch

tfsversion-control

Using TFS, when would you label your code and when would you branch?

Is there a concept of mainline/trunk in TFS?

Best Solution

A label in TFS is a way of tagging a collection of files. The label contains a bunch of files and the version of the file. It is a very low cost way of marking which versions of files make up a build etc.

A branch can be thought of as a copy of the files (of a certain version) in a different directory in TFS (with TFS knowing that this is a branch and will remember what files and versions it was a branch of).

As Eric Sink says, a branch is like a puppy. It takes some care and feeding.

Personally, I label often but branch rarely. I create a label for every build, but only branch when I know that I need to work on a historical version or that I need to work in isolation from the main line of code. You can create a branch from any point in time (and also a label) so that works well and means that we don't have branches lying around that are not being used.

Hope that helps,

Martin.