Error setting vscode as difftool and mergetool in windows

665 Views Asked by At

I am getting the below error when I try to use merge tool in git.

git config option merge.tool set to unknown tool: code
Resetting to default...

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare smerge emerge vimdiff nvimdiff

I want to use vscode as difftool and merge tool.

Here is my config file

[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = code --wait --diff $LOCAL $REMOTE

How can I configure vscode as my difftool and mergetool?

1

There are 1 best solutions below

0
VonC On

Git bash on windows, “code” on command line opens vscod

That means code is in your %PATH%/$PATH.

If "'merge.tool' is not configured.", that means you are running the Git session with a different account than the one where code, on command-line, work.

In that problematic session, try:

git config -l --show-origin --show-scope|grep merge

Check if merge.tool is indeed set.