Wednesday, May 14, 2014

TFS switch working copy to another branch

Problem

I assume that you already have a working copy of $/branch1.
Let's say it's checked out to local folder c:\inetpub.
And you want to remap this working copy to $/branch2 without re-downloading everything again.

Solution

  1. First you'll need to unmap existing branch.
  2. Map working copy folder to new branch.
  3. Apply remap recursively.

Run the following commands from command line:

tf workfold /unmap $/branch1
tf workfold /map $/branch2 c:\inetpub
tf get c:\inetpub /remap /version:T /recursive


You'll probably want to unshelve a shelveset from another TFS branch afterwards.