I use git bash, and Visual Studio 2019's built in git repository integration side-by-side for source control on the same repositories. By default, when I'm in Visual Studio and view changes to a file, the diff is shown within Visual Studio. When I run "git difftool" from the command line, the diffs are shown in a vim editor.
I want to change the git bash difftool from vim to vscode, so I changed my .gitconfig file like so:
[core]
editor = code
[user]
name = myname
email = [email protected]
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
Now running git difftools via command line opens the diff in a VSCode window. But this also causes Visual Studio to open the diff in a new VSCode window, rather than using it's built in diff viewer.
Is there a way to set up a default difftool for only git bash and not change the value for Visual Studio 2019?
I believe I've found an acceptable answer:
I added 2 different difftool settings and then added "dt" as an alias that calls the one I want from the command line.
Solution is adapted from here: https://www.reddit.com/r/dotnet/comments/b9f9y6/visual_studio_ignoreoverride_git_diff_tool/ek4qa9f?utm_source=share&utm_medium=web2x&context=3