Visual Studio 2017 Cannot Move Shelveset to Another Branch

核能气质少年 提交于 2019-12-03 05:53:58

Another WORKAROUND...

  1. Check in the changes from existing shelveset (Changeset 1)
  2. Merge the changes to the other branch and check in (Changeset 2)
  3. Rollback the changes from Changeset 1.

This keeps changes from changeset 2 and rolls back the original branch.

This process may not work for every company and their policies but it does work. I don't like it but sometimes it is necessary.

Unfortunately move Shelveset to Another Branch with the command "tftp unshelve" or "tf unshelve" is still not supported for now in VS 2017.

There's already a feedback submitted here to track that, just as Youhana Naseim [MSFT] mentioned below (source here) :

For VS 2017 we do not have a power tools release. We are constantly evaluating the features that are still missing in the product. The three most notable ones are:

  • TFS Windows Shell Extensions integration

  • Find by Status for server workspaces

  • Unshelve /migrate

So as a workaround, you can try below ways:

I absolutely agree this is a greatly missed feature in 2017 and up. After too many times of doing this manually, I decided to add it to my (free) Visual Studio Extension called 'MultiMerge'. You can now right-click a shelveset and choose your target branch. There's a VS2017 version and VS2019. Or you can simply choose this extension using Tools and Extentions menu in Visual Studio.

Feel free to rate the extension, and let others find it more quickly:)

Here's how I do it when I know the branch files can be overwritten directly by the shelf-set. If you need to merge, then use win-merge with directory compare to stitch things back together.

  • Close all instances of Visual Studio
  • Rename your local source directory to a temporary name
  • Open Visual Studio
  • Unshelve your changes normally - VS will recreate the directory structure with just your changes in it.
  • Copy all your changed files into your branch directory (overwrite read-only files)
  • Close visual studio
  • Rename your local source directory back to its original name (get rid of the one VS recreated)
  • Reopen your branch project
  • Two options now: you can go offline then back online again to let VS figure out what changed, or just check out your whole folder and then check in again. Just make sure you don't have anything else checked out before you do it!

It's a shame that this hasn't been put into VS as a native feature yet, but when you consider the complexity of un-shelving into a code merge, and preserving history, etc, the task becomes complex. Good luck!

Another probably easier way working with VS2019 is to copy/paste your source folder to the branch target folder and use

tf reconcile /promote

to detect all added or changed files.

Since until now (may 2019) TSPT is not available in Visual Studio 2017.

The workaround i found is to create a new Branch and use a tool like WinMerge (http://winmerge.org) to compare and merge changes from Main to the new Branch then when it's all right i undo changes on the main branch.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!