Renaming a branch with shelvesets

Caution: Renaming branches in TFS 2010 is a very bad idea unless you follow a very specific set of steps:
https://blogs.msdn.com/b/chandrur/archive/2010/06/09/renaming-branches-in-tfs-2010.aspx.

In TFS 2010, Unshelve will follow pending renames but it will not follow renames committed between when the shelveset was created and the current workspace version. 

Here are two cases.

Case 1:

    • In some workspace, an edit is made to $/Proj/Main/foo.txt and is shelved in a shelveset named “changes”.
    • In your workspace, you have a pending rename on the branch such that $/Proj/Main will become $/Proj/Main2010.
    • You try to unshelve the shelveset named “changes” into your workspace
    • In this case, the change on foo.txt will be unshelved in the local folder that corresponds to $/Proj/Main2010, since that rename is currently pending in your workspace.

Case 2:

    • In some workspace, an edit is made to $/Proj/Main/foo.txt and is shelved in a shelveset named “changes”.
    • In your workspace, you pend a rename on the branch such that $/Proj/Main will become $/Proj/Main2010.
    • You check in your changes to rename $/Proj/Main to $/Proj/Main2010.
    • You try to unshelve the shelveset named “changes”.
    • In this case, the change on foo.txt will be unshelved in the local folder that corresponds to $/Proj/Main and not the newly renamed branch
    • In order to fix this, you can issue a “Get” for your workspace.  Get will find conflicts that will force you to select the proper location for this change and allow you to move the unshelved changes under the renamed branch.

Thanks to Taylor Lafrinere (Microsoft)

Caution: Renaming branches in TFS 2010 is a very bad idea unless you follow a very specific set of steps:  
https://blogs.msdn.com/b/chandrur/archive/2010/06/09/renaming-branches-in-tfs-2010.aspx.