Skip to content

RandomEngy/VSCodeGitDiffAndMergeTool

Folders and files

NameName
Last commit message
Last commit date
May 16, 2019
May 17, 2019
Oct 2, 2021
Apr 18, 2020
May 16, 2019
May 29, 2019
May 16, 2019
Oct 2, 2021
Oct 2, 2023
Jan 27, 2023
May 16, 2019

Repository files navigation

Git Diff and Merge Tool

Diff and merge tools can be integrated with Git so they are launched with git difftool <file> and git mergetool <file>.

This extension allows you to launch those tools from Visual Studio Code.

Demo

demo

Setup

To register your diff/merge tool with Git you need to edit your .gitconfig file:

git config --global --edit

For example, this sets up Beyond Compare 4 on Windows:

[diff]
    tool = beyondcompare4
[difftool "beyondcompare4"]
    cmd = \"C:\\Program Files\\Beyond Compare 4\\bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = beyondcompare4
[mergetool]
    keepbackup = false
[mergetool "beyondcompare4"]
    cmd = \"C:\\Program Files\\Beyond Compare 4\\bcomp.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"
    trustexitcode = true

keepbackup = false prevents the system from creating .orig backup files after a merge. trustexitcode = true tells Git that the diff tool's exit code can be trusted to determine the outcome of the merge.

Changelog

1.0.5

2021-10-02

  • Added configuration option to disable the notification on launching the tool.
  • Added error notification if VSCode fails to provide the command parameter, which can sometimes happen when the merge conflict list is being refreshed.