4

I'm aware it is possible to do it with HEAD but we need to compare it with another commit, is it impossible?

user33276346
  • 1,501
  • 1
  • 19
  • 38

2 Answers2

2

While you can compare two commits in Visual Studio (2017+), you might need an extension to compare commits for a given file.

Check first the compare option on a file: see "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.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes, it is possible to compare a file's changes between two commits, it's also possible to compare the changes in the working directory with the last commit (HEAD) but I can't find the way, if it exists, to compare the a file's changes in the working directory with other commits. – user33276346 Nov 29 '19 at 12:44
  • @user33276346 I agree, which why I mention the need for an extension. An alternative would be to make a temporary commit, with just that file, but that is not ideal. – VonC Nov 29 '19 at 13:08
0

Any comparison is possible as far as I know, we just have to define Visual Studio as difftool in git, then write the diff we need in the following fashion:

git difftool xxx

Visual Studio will open, showing you the results visually.

user33276346
  • 1,501
  • 1
  • 19
  • 38