Unshelve shelveset created from one branch to another

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 

image

Below is a list of features that are installed with the March 2011 Power tool installation.

image

Once the installation is complete, go to the cmd and type />tfpt.exe

image

we are interested in />tfpt unshelve to achieve unshelving of a shelve set to a different branch

image

Syntax

**/>**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)

Sample

/> tfpt unshelve “MySampleShelveName” /migrate /source:”$/MyTeamProject/TheOrigionalBranch” /target:”TheDestinationBranch”

Catches

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?

](http://digg.com/submit?url=http%3a%2f%2fgeekswithblogs.net%2fTarunArora%2farchive%2f2011%2f06%2f06%2funshelve-shelveset-created-from-one-branch-to-another.aspx&title=Unshelve+shelveset+created+from+one+branch+to+another)

This article is part of the GWB Archives. Original Author: Tarun Arora [Microsoft MVP]

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.