Often i have seen fellow developer working on one branch and later realizing that they intended to check in the code in a different branch, a simple example, working on the MAIN branch and later realizing that the code needs to be checked in to the QA branch. TFS power tool comes to your rescue… when you need to unshelve to a different branch.
The power tool command /> tfpt.exe unshelve can be handy for the following,
- Allows a shelveset to be unshelved into a workspace with pending changes.
- Merges content between local and shelved changes.
- Allows migration of shelved changes from one branch into another by rewriting server paths.
- Allows changes from an already-unshelved shelveset to be undone, cleaning up pending adds, and preserving other existing pending changes in the workspace.
Download and install the latest TFS Power tools http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Below is a list of features that are installed with the March 2011 Power tool installation.
Once the installation is complete, go to the cmd and type />tfpt.exe
we are interested in />tfpt unshelve to achieve unshelving of a shelve set to a different branch
/>tfpt unshelve [shelvesetname[;username]] [/nobackup]
[/migrate /source:serverpath /target:serverpath]
shelvesetname The name of the shelveset to unshelve
/nobackup Skip the creation of a backup shelveset
/migrate Rewrite the server paths of the shelved items
(for example to unshelve into another branch)
/source:serverpath Source location for path rewrite (supply with /migrate)
/target:serverpath Target location for path rewrite (supply with /migrate)
/undo Undo pending changes from an unshelved shelveset
/batchsize:num Set the batch size for server calls (default 500)
/> tfpt unshelve “MySampleShelveName” /migrate /source:”$/MyTeamProject/TheOrigionalBranch” /target:”TheDestinationBranch”
If you get the error => "unable to determine the workspace"
NOTE: Take the latest from your source control and “cd” to a local path that is mapped to the target workspace. Also ensure that the current working directory is mapped, you can run "tf workspace" and see if the target folders are mapped.
Have you tried this yet?