Sunday, 25 August 2013

How to unshelve changes from one branch to another in TFS


                 We all been there, after an release is moved to production, we move from one release to another for new development, so you need to get new copy of source code to work in our current development. But we have changes that are available in the OLD RELEASE BRANCH, that is needed for new development, it is very painful to copy  source files, one by one by comparing the folders and their files.

Best way is to SHELVE the changes to old release folder and then UNSHELVE in the current release folder. But this cannot be done in single right click.

Below are the steps to unshelve changes from one branch to another


1.       Open Visual studio 2008 command prompt in Administrator mode

2.       Navigate to the common folder w.r.t to branches  in command prompt

3.       Run the below  command

tfpt unshelve "<shelveset name>";<developername> /migrate /source:"<source branch solution path>" /target:"<target branch solution path>"

4.       You will be asked to confirm the files that needs to be merged as a popup

5.       If there are any error message, then it may be usually because of any pending changes.

6.       Undo the pending changes that came as error

7.       Once the merge is successful, you will see the following success message




EXAMPLE:

Source folder Path: E:\Karthik\Code\Releases\5.3\DR1\YYYY

Target folder Path: E:\Karthik\Code\Releases\5.3\DR2\YYYY

Common folder Path(between two branches): E:\Karthik\Code\Releases\5.2

tfpt unshelve "XXXX-8Feb";karthikeyank /migrate /source:"$/YYYY/Releases/5.3/DR1" /target:"$/YYYY/Releases/5.3/DR2/"



Checklist before tfpt Unshelve
  •  Make sure you install TFS power tools as per your TFS. 
  • Please make sure you navigate to the corresponding  common folder path and run the command. Otherwise you might get "workspace not found error"
  • Always use version of the power tools to match your visual studio version you are using, eg: For VS 2015 use TFS Power tools 2015
  • Get latest version of the unshelving branch
  •  If possible check in/Undo the file checked out
  • If you get a workspace not found error, run the below command, which will renew the cache.

    tf workspaces /s:http://<YOUR-TFS-SERVERNAME>:8080/



Leave a comment to share what you learned, and hit the “like” button to let others know about it (make sure you’re logged into Facebook to like and comment).


No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Build Bot using LUIS