有没有办法在 VS2010 中比较两个分支的差异/文件版本?
有谁知道是否有一种方法可以通过某种 diff 工具检查生产修补程序分支中的代码是否不比主流分支新? (hotfix1 vs thrunk)
\src
\thrunk
\releases
\hotfix1
我正在使用带有TFS的vs2010,但是分支有很多文件,我想到的只是一次比较一个文件,通过重新指定其中一个文件的目标路径。
Does anyone know if there is a way to check if code from production hotfix branch is not newer than mainstream branch via diff tool of some sort? (hotfix1 vs thrunk)
\src
\thrunk
\releases
\hotfix1
I'm using vs2010 with TFS, but the branches have a lot of files, and all I came up with was comparing one file at a time, by re-specifying the target path of one of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以在 Visual Studio 中直接执行此操作 - 如果您打开团队资源管理器并转到源代码管理,您可以递归地比较文件夹(甚至是工作区中没有的文件夹)。只需导航到其中一个分支,右键单击并选择选择
比较
并输入另一个分支作为目标。You can do this from right within Visual Studio - if you open Team Explorer and go to Source Control, you can compare folders recursively (even ones you don't have in your workspace.) Simply navigate to one of the branches, right click and select
Compare
and enter the other branch as the target.在 Visual Studio 中,在菜单栏中选择:
注意:注意此屏幕上的所有不同选项。
In Visual Studio, in the menu bar select:
NOTE: Notice all the different options you have on this screen.
使用命令行工具
tf.exe
,您可以比较任意文件的两个版本,但两者都必须位于您的工作区中。有关详细信息,请参阅
tf diff
上的联机帮助(以及此处用于指定版本)。注意。在VS中使用工具|选项|源代码控制| Visual Studio Team Foundation Server | Visual Studio Team Foundation Server配置用户工具以定义要使用的差异/合并应用程序(网络搜索将找到要使用的正确命令行)。输入
.*
作为文件类型将用于所有内容,无需更具体的工具集。Using the command line tool
tf.exe
you can compare two revisions of arbitrary files, but both have to be in your workspace.See online help on
tf diff
for details (and here for specifying versions).NB. In VS use Tools | Options | Source Control | Visual Studio Team Foundation Server | Configure User Tools to define what diff/merge application to use (a web search will find the right command line to use). Entering
.*
for the file type will be used for everything without a more specific tool set.使用前面提到的“比较”功能很棒,但拥有良好的过滤器使其更有用。否则,您可能会因大量信息而不堪重负。
以下是我当前使用的过滤器,它们对我来说非常有用:
!debug\;!obj\;!bin\;!temp\;!*ReSharper*\;*.sln;*.*proj;* .config;*.cs;*.vb;*.bmp;*.GIF;*.JPG;*.png;*.ico;*.ini;*.resx;
前几项删除了一些文件夹你可能想排除(如果您正在使用 debug、obj、bin、temp、Resharper 等东西,强烈建议您这样做!)。
其余的文件是我认为包含在搜索中有用的文件。如果您想查看其他文件类型,只需将它们添加到列表末尾即可。
Using the "Compare" function as mentioned previously is great, but having good filters makes it way more useful. Otherwise you can get overloaded with huge amounts of info.
Here are the filters I am currently using which work very well for me:
!debug\;!obj\;!bin\;!temp\;!*ReSharper*\;*.sln;*.*proj;*.config;*.cs;*.vb;*.bmp;*.GIF;*.JPG;*.png;*.ico;*.ini;*.resx;
The first few items eliminate some folders you probably want to exclude (debug, obj, bin, temp, Resharper stuff if you are using it - and it is highly recommended that you do!).
The rest are the files that I find useful to include in the search. If there are other file types you want to see, just add them to the end of the list.
您可以将一个分支合并到另一分支而无需提交。然后你就可以在Visual Studio中看到所有的变化。完成后,您只需重置所有更改(如果您不想合并)。
You can merge one branch into the other without committing. Then you can see all the changes in visual studio. When you're done you just have to reset all the changes (if you don't want to merge).
实际上,您不必在同一个工作区中即可与 VS 进行比较,甚至不必在 TFS 中进行比较。 1 或两者都可以位于文件系统(“比较”dlg 中的“本地路径...”)或 TFS 中(“服务器路径...”)。 “过滤器”部分也非常强大,能够按文件类型扩展/限制比较对象。
actually you dont have to be in the same workspace to do compares from VS - or even both in TFS. 1 or both could be in the file system ("Local Path..." in "Compare" dlg) or in TFS ("Server Path..."). THe "Filter" section is very powerful as well, to be able to expand/restrict the comparison objects by file type.
您可以从 Visual Studio 轻松完成此操作,但如果您像我一样并且不想弄乱本地分支,您也可以从 VSTS 网站执行此操作,
这并不困难听起来,:)
You can do it easily from Visual Studio, but if you are like me and don't want to mess you local branch, you can also do it from the VSTS Website
it is not as difficult as it sounds, :)