What Visual Studio Code extension is good for 3 way merging?

I wasn't able to find a working VSCode extension that let you right click and launch the merge tool for a specific file, so I wrote the Git Diff and Merge Tool extension.

This requires registering the merge tool with Git:

git config --global --edit

The specific values depend on which tool you are integrating. This is what I have for Beyond Compare 4:

[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.


Three-way merge (3-way merge) is being built into vscode v1.69. See Release notes; 3-way merge,

In this release, we continued working on the 3-way merge editor. This feature can be enabled by setting git.mergeEditor to true and will be enabled by default in future releases.

The merge editor allows you to quickly resolve Git merge conflicts. When enabled, the merge editor can be opened by clicking on a conflicting file in the Source Control view. Checkboxes are available to accept and combine changes in Theirs or Yours:

demo of 3-way merge

All language features are available in the merge editor (including diagnostics, breakpoints, and tests), so you get immediate feedback about any issues in the merged result.

The result can also be edited directly. Note how the checkbox update as expected:

further demo of 3-way merge

When closing the merge editor or accepting the merge, a warning is shown if not all conflicts have been addressed.

The merge editor supports word-level merging - as long as the changes don't intersect, both sides can be applied. If the insertion order matters, it can be swapped. At any time, the conflict can also be resolved manually.

demo 3 of 3-way merge