Showing posts with label Shelveset. Show all posts
Showing posts with label Shelveset. Show all posts

August 05, 2013

How to: Move (migrate) a shelveset from one branch to another branch

If you want to move changes from one branch to another - when a merge is not possible - you can make a migration. 

The migration is made using the following TFS Power Tools command - executed via a Visual Studio command prompt from the target branch:

TFPT unshelve "<shelveset name>[; <shelveset creator name>]" /migrate /source:<source branch> /target:<target branch>

If you are migrating your own shelveset you don't have to enter the name of the selveset creator. To migrate the shelveset of another user you have to specify the displayname of the shelveset creator.

During the migration process a windows will appear showing the state of each file in the shelveset. You will then be able to select what to do with each file; ignore any changes, use the shelveset file or merge the files.

The changes are not automatically checked in - you have do a manually checkin afterwards. The files can be found as pending changes.

Example
TFPT unshelve "My Shelveset" /migrate /source:$/MyProject/Hotfix /target:$/MyProject/Development

The result of this command is that the files in "My Shelveset" (creted by myself) are moved from the "$/MyProject/Hotfix" branch to the "$/MyProject/Development" branch. 

Only shelvesets

You cannot move one (or more) changeset to another branch - only shelvesets can be moved. To move a changeset, you have to make it a shelveset - see: How to: Create a shelveset from a changeset.


How to: Create a shelveset from a changeset

It is not possible directly, to make a shelveset from a changeset! To achieve this you can follow these steps:
  1. Find the changeset and make a rollback on it
  2. Check in pending changes (the files that have been rolled back)
  3. Take a note of the new changeset number
  4. Create a rollback of the new changeset
  5. Create a shelveset of the pending changes (Preserve pending changes locally)
  6. Do a check in of the pending changes