有没有办法在 VS2010 中比较两个分支的差异/文件版本?

发布于 2024-11-14 18:51:55 字数 220 浏览 5 评论 0原文

有谁知道是否有一种方法可以通过某种 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

眉黛浅 2024-11-21 18:51:55

您可以在 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.

方觉久 2024-11-21 18:51:55

在 Visual Studio 中,在菜单栏中选择:

  1. 查看>>其他窗口>>源代码管理资源管理器
  2. 右键单击项目(文件夹、分支、文件等)>>>比较...
  3. 在目标路径中输入要比较的项目,如下所示

注意:注意此屏幕上的所有不同选项。

在此处输入图像描述

In Visual Studio, in the menu bar select:

  1. View >> Other Windows >> Source Control Explorer
  2. Right click the item (folder, branch, file etc.) >> Compare...
  3. Enter the item to compare to in the Target Path as shown below

NOTE: Notice all the different options you have on this screen.

enter image description here

慈悲佛祖 2024-11-21 18:51:55

使用命令行工具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.

早乙女 2024-11-21 18:51:55

使用前面提到的“比较”功能很棒,但拥有良好的过滤器使其更有用。否则,您可能会因大量信息而不堪重负。

以下是我当前使用的过滤器,它们对我来说非常有用:

!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.

你穿错了嫁妆 2024-11-21 18:51:55

您可以将一个分支合并到另一分支而无需提交。然后你就可以在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).

痴梦一场 2024-11-21 18:51:55

实际上,您不必在同一个工作区中即可与 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.

2024-11-21 18:51:55

您可以从 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

  • go to the pull request
  • select the Files tab
  • select the file you want to compare (you will see ...) that will open a menu
  • View History
  • Find the file you want to compare
  • Select Tab Compare
  • You will see the commit number on top that you can change to compare the versions of your file

it is not as difficult as it sounds, :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文