Visual Studio 2017 Cannot Move Shelveset to Another Branch

 ̄綄美尐妖づ 提交于 2019-12-04 10:06:37

问题


Since they have supposedly integrated most of the Power Tools functionality into VS2017, the new command "tf unshelve" does not work the same as the old command "tfpt unshelve" to move shelvesets to another branch, as you cannot add a source and a target using the new command. I really don't want to have to install VS2015 on my laptop just to move a shelveset. Does anyone know how to do this with VS2017? I'm having a hard time believing this is no longer possible.

Any assistance is greatly appreciated!


回答1:


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.




回答2:


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:

  • Use tf unshelve and tf rename command to achieve this in two steps.
    1). c:\projects>tf unshelve 2). c:\projects>tf rename 314.c ..\newdir\1254.c
  • Copy shelved files manually to target folders and do compare against the server version as Alexander Nikonov mentioned here.
  • Install VS2015 and Microsoft Visual Studio Team Foundation Server 2015 Power Tools.



回答3:


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:)




回答4:


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!




回答5:


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.




回答6:


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.



来源:https://stackoverflow.com/questions/49371144/visual-studio-2017-cannot-move-shelveset-to-another-branch

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