Visual Studio Code Diff

Posted on  by 



As Visual Studio Code continues to evolve there are some command line switches that make it even more interesting to use.

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform. Open file /.gitconfig in Visual Studio Code: code /.gitconfig Copy the following lines in /.gitconfig: diff tool = default-difftool difftool 'default-difftool' cmd = code -wait -diff $LOCAL $REMOTE Save the changes. Open a terminal in Visual Studio Code by running.

By issuing /path/to/vscode sourcefile destinationfile --diff you can have VS Code display a visual file diff. On its own that is somewhat useful if you have to files in different locations you want to diff.

A more common use for a diff is with your source code management system, namely git.

You can setup an external diff tool in your .gitconfig with the following setting for VSCode for Windows.

Visual Studio Code Diff View

And to test it and get the following result create a throw away repo by way of

Visual Studio Code Diff

Visual Studio Code Difftool

and you should get something that looks something like

Visual Studio Code Diff Merge

Once they have git merge UI support it would seem you could also use this as your external merge tool as well.





Coments are closed