VS Code as a Diff Tool

12. June 2017 11:07

Visual Studio Code is a popular (and free) editor. It can also be used as a GUI for viewing git repository differences.

1) Locate gitconfig. It will most likely be found at C:\Users\<YOU'RE USER NAME>\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\mingw32\etc. The following command can also be used to assist in locating gitconfig.

git config --list --show-origin

2) Edit the gitcongif file and add the diff and diff tool sections (VS Code is a good editor to use for this!)

[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE

3) After others have checked changes into the remote repository which you have not pulled, run the following which will launch VS Code and highlight differences for each file (replacing sprintNN with the correct branch).

git difftool remotes/origin/sprintNN..sprintNN

About the author

I'm a .NET developer, a husband and a father of three beautiful girls.

Month List