是否无法将文件更改与 Visual Studio 2019 中的特定提交进行比较?

Is it impossible to compare a file changes with a specific commit in Visual Studio 2019?

我知道可以用 HEAD 来完成,但我们需要将它与另一个提交进行比较,这是不可能的吗?

虽然您可以比较 two commits in Visual Studio (2017+),但您可能需要一个扩展来比较给定文件的提交。

首先检查文件的比较选项:参见“Compare two versions of a file on your server”:

You can compare two versions of a file in the history of that file on your Team Foundation Server.

  • On the menu bar, choose View, Other Windows, Source Control Explorer.
  • In Source Control Explorer, open the shortcut menu for the file and then choose View History.
  • Select two versions of the file, open the shortcut menu, and then choose Compare.
    The Diff window appears.

据我所知,任何比较都是可能的,我们只需要将Visual Studio定义为git中的difftool,然后按照以下方式编写我们需要的diff:

git difftool xxx

Visual Studio 将打开,直观地显示结果。