Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

diff tool (vscode) doesn't launch from cmd

Tags:

git

Using Git and I want to merge branch lisa into my master branch, like this:

$ git merge lisa

So I opened my repository and then to .git in the Windows Explorer, to reach the .config (Git config file):

[diff]
    tool = vscode
[difftool]
    prompt = true
[difftool "vscode"]
    cmd = \"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"$LOCAL\" \"$REMOTE\" --diff --wait
    trustExitCode = false

My issue is that when I write the following command:

git difftool

I see the differences in cmd itself, instead of having vscode launched for editing and merging.

What's the issue here? Why isn't Visual Code launched?

Also tried

git difftool --tool=vscode

but same issue.

like image 533
annepic Avatar asked Nov 25 '25 12:11

annepic


1 Answers

I actually don't need to set any difftool when working with VSCode.

Simply do your merge, then open the root folder of your Git repo folder with VSCode.
If you have installed GitLens, you will see all the changes, including possible conflicts. And you will be able to resolve said conflict directly from VSCode.


That being said, the config needed seems simpler in "How to use Visual Studio Code as Default Editor for Git MergeTool"

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

(this assumes here that C:\\Program Files\\Microsoft VS Code is on your %PATH% or $PATH)

like image 176
VonC Avatar answered Nov 28 '25 03:11

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!