We’ve probably all been there; working on a branch while a teammate works on another. We both make changes, then race to see who can get their testing done and merge their branch to Main first. The poor unfortunate soul who’s last ends up being the one dealing with merge conflicts. There are lots of tools to make that task more palatable, many of which cost money or at least time in taking us out of our favorite tools.
Fortunately for those of us who work in Visual Studio Code, the excellent cross-platform text/code editor from Microsoft, it got a big update when it comes to working with git branches.
You’ve probably already got these lines in your ($HOME\
or ~/
) .gitconfig
file
[difftool "vscode"]
cmd = code --wait --diff \"$LOCAL\" \"$REMOTE\"
[mergetool "vscode"]
cmd = code --wait -m $REMOTE $LOCAL $BASE $MERGED
[ diff]
tool = vscode
[merge]
tool = vscode
After getting the July 2022 update, when you git merge origin/main
and git mergetool
, you too can work to resolve merge conflicts like this
VS Code with new merge editor
Merge where both changes are needed
In immediately-previous versions you could also use Ctrl/Cmd-Shift-P and search/type Open User Settings (JSON)
to enable this in VSCode’s settings.json file.
"git.mergeEditor": true,