If you use Visual Studio Code there is very high probability, that you use also Git as your main version control system.
You can set Visual Studio Code as default editor and Diff tool which will be showing changes between two different commits.
To set Visual Studio Code as your default editor enter this command into command line:
git config --global core.editor "code --wait"
On Windows – I assume that path to your Visual Studio Code executable was added into global variable PATH. I might do it unwillingling during instalation proces. To test if your Visual Studio Code is added to PATH you could: press Win+R and then enter
code and press Enter. If no Error will be present then you can say that Visual Studio Code is added to your PATH.
After setting Visual Studio Code as your default editor, then command like this
git config --global -e which is opening global
.gitconfig into editor will open into Visual Studio Code.
By the way switch
--wait holds shell until Visual Studio Code is closed. The normal behavior is to return access to shell as soon Visual Studio Code is loaded. Git waits for signal from shell to commit changes from temporary file to main file.
To set Visual Studio Code as your
difftool, you need to go into global git config file. Which you can access through previous mentioned command
git config --global -e, then you need to add those entries (or replace existing ones).
[diff] tool = vscode [difftool "vscode"] cmd = code --wait --diff $LOCAL $REMOTE
You can use
difftool this this. To show diffrence between latest commit (HEAD) and one commit previous than HEAD (HEAD~1) Enter this command into command line:
git difftool HEAD~1 HEAD
difftool in action: