Showing posts with label TFS. Show all posts
Showing posts with label TFS. Show all posts

August 06, 2013

How to: Move a TFS folder or branch

It is possible to move a branch or folder in TFS - instead of copying the folder manually in the filesystem. The benefit of using TFS to move a folder is that it preserves the full history (and the parent/child relationship if its a branch) when merging.

Right-click on the folder to be moved and select 'Move...'


A dialog box appears letting you enter (or select) the new path and foldername.


Done. It's that easy - and the history is preserved.

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

July 13, 2013

How to: Delete a TFS Team Project

I have a lot of Team Projects at http://tfs.visualstudio.com/ - but sometimes I use a name which I later regret. Fortunately you can delete a Team Project using the "TFSDeleteProject.exe" command line tool, which is usually located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE. 
Just open a Command Prompt in that folder (or a Developer Command Prompt for Visual Studio) and run the delete command:
TFSDeleteProject.exe /force /collection:https://<YourCollection>.VisualStudio.com/DefaultCollection "Project name"
NOTE: The /FORCE switch is optional, but if you received errors creating a team project or had troubles accessing it after creation and want to force it's deletion, the /FORCE switch may be necessary. It doesn't hurt to use it all the time.