Can we switch between branches in TFS
what i want is i downloaded a working copy and now I want to switch to different branch without downloading everything, because for large projects it will take lot of time since developers spend lot of time downloading
Is it possible, if not any workaround ??
You can switch branches from the command-line client (only downloading the differences) by changing your workspace mappings and using the
/remap
flag to theget
command:In TFS branches are "physically" present in the Source Control, they're like "special folders". So you can totally choose what branch you get locally by targeting the right folder for your get.
If you have for instance:
and you want to get at the "Projects" level with only the content of "Dev", you can create mapping in your Workspace definition to cloack the V1 branches of ProjectA and B.
Just for supplementing the knowledge base - my colleague Isak Savo created useful batch for such purpose. You need to do some editing inside the script (at the top) to point to the correct source code location and appropriate branches. The core is basically the same as in Edward Thomson answer, but with some interactive logic added. I made some minor changes (directory context switching for
tf
commands, quotes for arguments - needed if there are spaces in directories) and shared it below:Save it e.g. to switch_branch.cmd and execute from any directory from your machine.
You can switch between multiple branches, as long as you are using same workspace and the working directory contains the branches.
Team Explorer Everywhere has a "Switch to branch" command, which is probably what you're looking for.
Visual Studio, on the other hand, doesn't have the same command...