How to configure Visual Studio Code for Git merges and diffs
Edit .gitconfig
On a Mac, Xcode is configured as the default Git mergetool and difftool. Configure it to use Visual Studio Code instead.
.gitconfig
[user]
name = Your Name
email = yourname@email.com
# #region Configure VS Code.
# Wait for VS Code to close the file.
[core]
editor = code --wait
# Use VS Code as mergetool instead of Xcode.
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code -n --wait $MERGED
# Use VS Code as difftool instead of terminal.
[diff]
tool = vscode
[difftool "vscode"]
cmd = code -n --wait --diff $LOCAL $REMOTE
# #endregion
[init]
templatedir = $HOME/.git-template
defaultBranch = main