【发布时间】:2008-09-22 20:19:25
【问题描述】:
假设我团队中的某个开发人员搁置了他在分支 A 中所做的更改。而我正在处理分支 B。我可以将他的更改搁置到分支 B 中吗? (通过 GUI 或命令提示符)
【问题讨论】:
-
上述命令演示:Unshelve command basics
标签: tfs branch shelve unshelve
假设我团队中的某个开发人员搁置了他在分支 A 中所做的更改。而我正在处理分支 B。我可以将他的更改搁置到分支 B 中吗? (通过 GUI 或命令提示符)
【问题讨论】:
标签: tfs branch shelve unshelve
Visual Studio Power Tools 应该让你这样做。
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
例如,要将在 Branch1 上创建的名为“Shelve Set Name”的搁置集合并到 Branch2,请使用以下命令:
>tfpt unshelve "Shelve Set Name";domain\userName /migrate /source:"$/Project/Branch1/" /target:"$/Project/Branch2/"
【讨论】:
避免手动合并每个文件的 tfpt 替代解决方案
tfs 电动工具的问题在于you're doing a 'baseless merge' so have to confirm every file。我有超过 800 个文件的搁置集,我从不相信“自动合并”按钮,也不想依次浏览每个文件 - 所以我必须找到另一种方法!
C:\temp\shelveset-name
(注意:导出时没有进度条 - 因此,如果您有一个需要很长时间才能导出的大型搁置集,您只需在 Windows 资源管理器(文件>属性>大小)中检查文件是否仍然存在如果您认为它已冻结,请关闭)。
您现在只需使用 Windows 资源管理器将它们复制到新分支。
这对我有用:
c:\temp\shelveset-name 中的目录结构必须重命名以对应新分支。 提示:确保复制到正确的位置!!!
重要提示:我发现,如果您不先使 TFS 脱机,那么您最终会看到任何新文件(来自您的 unshelves 变更集)显示没有一点红色复选标记,您必须排除和再次包括它们以使它们添加。如果有人对此问题有其他解决方案,我很想知道 - 刷新似乎不起作用。
【讨论】:
货架信息包括它去往的具体路径。不幸的是,除了搁置到的位置之外,我不知道有任何自动方式可以将其搁置到任何位置。有时我想这样做,我不得不检查新分支中的等效文件,从旧分支中取消搁置,然后手动复制文件。
编辑:嗯,我想我做得很艰难。我将不得不尝试 Curt 的解决方案。 :)
【讨论】:
我花了很多时间来完成这项工作,但几乎没有什么问题需要克服。这是可能的,但这里很少有问题和规则可以避免这些问题
错误:
无法确定工作区
通过从 source 分支根文件夹运行命令解决了这个特定问题。这与他们说使用“目标”分支的一些答案相反 - 不,使用“源”:
cd [your !!source!! branch root]
tfpt unshelve /migrate /source:"$/MyCollection/Development/Maint1.1" /target:"$/MyCollection/Development/Maint1.2" "myShelveset;UserName"
在此之后出现了第二个问题。似乎它无法连接到 TFS 服务器。我意识到,我安装了多个 VS 并连接到不同的 TFS 服务器。我使用的是 VS12,我有工作区和服务器连接。但我没有意识到需要在 VS13 中复制相同的连接才能使 TFPT2013 工作。它连接到相同的服务器和工作区。
我也尝试过使用 TFPT2015,但我安装了它,但它没有安装 TFPT.exe,因此它没用。所以我尝试了从 TFPT2013 到 TFS2015,它适用于这个特定的命令。我想知道,如果 VS12/13 在 TFS2015 上运行良好,为什么不呢?
总结
【讨论】:
以下步骤可用于小尺寸搁置集(约 20 个文件或更少)。
【讨论】: