MohamedG's Log


How to: Switch Branches in a Workspace Without Getting All the Files of the New Branch?

One of the new features added in VSTF 2008 SP1 is that you can switch to another branch in your workspace and you don’t need to download all the files of the new branch. TFS will only download the files that differ in the new branch, if you use tf get /remap. It will also tell the server that you’re changing the association of the local items that you were mapped to the old branch, after running the command, they will be associated with the new branch.

From MSDN on using Get with the /remap option:

The /remap option saves download time when you remap a local folder to a new or different branch. For example:

  1. You map $/branch1 to D:\branch on your computer.

  2. You run tf get to get a copy of all the items from $/branch1 to the local folder.

  3. You change the mapping of $/branch1, and then map $/branch2 to the local folder previously mapped as $/branch1 (D:\branch).

  4. You run tf get with the /remap option to only download the content in $/branch2 that differs from content in $/branch1 on the local folder (D:\branch).