Mar
29

Create branch of modified working copy in TFS

posted on 29 March 2012 in programming

Warning: Please consider that this post is over 11 years old and the content may no longer be relevant.

So you’ve been working on your code from Team Foundation Server (TFS), made changes then realised you should really have started a branch for it.

I couldn’t find a good tutorial anywhere for how to do this so here’s the best workflow I found.

  1. Create a shelveset of your current working copy
    File > Source Control > Shelve Pending Changes
    Uncheck ‘Preserve pending changes locally’. This will undo all your pending changes.

  2. Create branch
    One way to do this is go to the Team Explorer tab > Source Control. Right click on the branch, trunk or root folder and select Branching and Merging > Branch.
    In Branch From Version, select By Workspace Version.

  3. Map branch to a working folder
    Right click on new branch and select Map to Local Folder.

  4. Unshelve your changes to the new branch
    To do this you need TFS Power Tools ‘unshelve’. More info here:
    http://geekswithblogs.net/TarunArora/archive/2011/06/06/unshelve-shelveset-created-from-one-branch-to-another.aspx

You can can now check in your changes to the new branch