TFS allows for code branching and merging operations. You may need both of these operations while working on the same project but two different versions of it. For instance, you just finished and deployed website and users start using it on a regular basis. In addition, you started to work on one more feature trying to release that feature next month. However, your website stopped working and you need to troubleshoot it as soon as possible. You cannot really update website which incorporates new feature since it’s not fully functioning yet. As a result, you get stack with the project.
TFS comes to a rescue with the help of Branching and Merging. This is not a new concept, but probably the most successful in its implementation. TFS can perform branching via Source Control Explorer or using command line utility called Branch Command.
tf branch file.cs myBranch
This command will create new branch with the latest version of the file.cs that you may want to update. There are several options that can be used with tf branch command.
- /version – specifies the version for which we want to create a branch. It can be changeset, number, label, workspace.
- /lock – lock source file and prevents other from checking in/out while you are working with the file.
- /noget – prevents users from creating local copies of the files in the new branch.
- /noprompt – prevents prompts from appearing every time you try to add item to the branch.
Branching and Merging requires certain permissions set on the server before you can start working and you need to set those rights for a developer trying to merge or branch TFS project. For instance, developer needs “Check Out” on source code permission to perform these two operations at the minimum.