Skip to content

Instantly share code, notes, and snippets.

@stormwild
Created October 17, 2019 07:43
Show Gist options
  • Save stormwild/65813bfefd88a880d1f31b303e55b1e7 to your computer and use it in GitHub Desktop.
Save stormwild/65813bfefd88a880d1f31b303e55b1e7 to your computer and use it in GitHub Desktop.

Visual Studio Code as Diff Tool

Comparing files using the command line Using Visual Studio Code

"%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe" --diff file1.cs file2.cs

Using Visual Studio Code Insiders

"%LOCALAPPDATA%\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --diff file1.cs file2.cs

Using Visual Studio Code as a git difftool

git difftool is a Git command that allows you to compare and edit files between revisions using common diff tools. You can use any editor that support diff such as VS Code. Open a command prompt and use the following commands:

git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"

By the way, you can also use Visual Studio Code as your git editor:

git config --global core.editor "code --wait"

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment