How to unshelve a shelveset from one branch into another branch!

I was doing a lot of work in our Main branch for a new version of our software. Lo and behold, this iteration requires we work on both the future and current version at the same time. Only a few of us are on the new version, therefore the Main branch code branched into a future version branch. Ugh. All my work sitting in a shelveset for the Main branch.

Moving it sounds painful to me. Luckily there is a really cool automated method provided by TFS. You simply need to deal with playing with the command line.

This guy did a good job giving an overview:

http://geekswithblogs.net/TarunArora/archive/2011/06/06/unshelve-shelveset-created-from-one-branch-to-another.aspx

This guy was easier for me to read:

http://chunkyinterface.wordpress.com/2012/02/17/migrating-shelvesets-between-branches-in-tfs/

tfpt unshelve - Unshelve into workspace with pending changes

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.

Usage: 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)

Here is an example I used in action:

tfpt unshelve "Native Templates Work" /migrate /source:$/Source/Main /target:$/Source/Main-6.0

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *