Search code examples
tfsbranchshelveunshelve

Can I unshelve to a different branch in tfs 2008?


Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt)


Solution

  • The Visual Studio Power Tools should let you do this.

    C:\src\2\Merlin\Main>tfpt unshelve /?
    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)
     /nobackup              Skip the creation of a backup shelveset
    

    For example to merge a shelve set called "Shelve Set Name" created on Branch1 to Branch2 use this:

    >tfpt unshelve "Shelve Set Name";domain\userName /migrate /source:"$/Project/Branch1/" /target:"$/Project/Branch2/"