2

I want to use a custom diff-tool in Visual Studio (2019) for specific file types, for example, I want to use the default visual studio diff tool for every other file type except for .xls and .xlsx extensions.

My use case is similar to Setup 'git diff' for special file types, however, I want to do it in Visual Studio (with git-scm).

~/.gitconfig

[diff "excel"]
    command = <path_to_my_diff_tool_for_xls>

~/.gitattributes

*.xls   diff=excel
*.xlsx  diff=excel

I have tried doing this at a repository-level and at a global-level with no success - Visual Studio just doesn't seem to pickup my diff-tool when I try to compare .xls files. It works successfully when I run git diff in the command-line - just not through the VS GUI.

Is there a reason that Visual Studio doesn't respect my diff-instructions in .gitattributes?


I found that when adding a local .gitattributes file through Visual Studio (Team Explorer > Settings > Repository Settings) it will generate a default, commented attribute file.

Within this file:

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs     diff=csharp

This wording (to me, atleast) implies that VS might not respect these types of entries in the .gitattribute files (besides through command prompt).


note: I am aware that I can override the diff tool, but I only want to use this tool on excel files and I can't find a way to do that like you could in TFS with the Configure User Tools popup.

Dion Misic
  • 21
  • 1
  • 1
  • 4

0 Answers0