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:

This guy was easier for me to read:

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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.