Anthony Chu Contact Me

Unshelving a Shelveset to Another Branch in TFS 2013

Monday, December 23, 2013

I recently shelved some code in TFS from my Main branch and wanted to unshelve it to another branch. It turns out this is possible using Team Foundation Server Power Tools.

Team Foundation Server Power Tools

TFS Power Tools adds a lot of functionality for dealing with TFS. For example, it adds a Visual Studio plugin to view and modify work item templates. It also adds shell extensions so that you can perform TFS actions within Windows Explorer.

The Power Tools also provides a bunch of command line utilities. You can see what it can do by typing tfpt /? into PowerShell…

Commands:
tfpt addprojectportal   Add or move portal for an existing team project
tfpt addprojectreports  Add or overwrite reports for an existing team project
tfpt annotate           Display line-by-line change information for a file
tfpt bind               Convert VSS-bound solutions into TFS-bound solutions
tfpt branches           Convert, reparent, list, and update branches
tfpt builddefinition    Clone, Diff or Dump build definitions
tfpt buildprocesstemplate       Manage build process templates
tfpt connections        Modifies Team Explorer client connection settings
tfpt createteamproject  Create a team project
tfpt getcs              Get only the changes in a particular changeset
tfpt online             Pend adds, edits, deletes to writable files
tfpt query              Query for work items
tfpt review             Review (diff/view) workspace changes
tfpt scorch             Ensure source control and the local disk are identical
tfpt searchcs           Search for changesets matching specific criteria
tfpt treeclean          Delete files and folders not under version control
tfpt unshelve           Unshelve into workspace with pending changes
tfpt uu                 Undo changes to unchanged files in the workspace
tfpt workitem           Create, update, or view work items

Unshelving to Another Branch

Using the unshelve command to unshelve a shelveset to another branch is pretty straight forward…

PS C:\TeamProject> tfpt unshelve /migrate /source:"$/TeamProject/Main" /target:"$/TeamProject/Dev" "My Shelveset"

It’ll display a GUI showing progress and perform the same auto-merging process that we’re used to when merging code in TFS.