Visual Studio Code is a neat editor with many good functionalities but I especially like the way it shows Git merge conflicts. Instead of a 2-way or a 3-way split it just shows one window with both changes, nicely highlighted with colors and actions.
I like this feature so much I decided to set Visual Studio Code as my Git merge tool for both the command line and Git Tower.
Using Visual Studio Code as a merge tool for Git when using command line means editing your
.gitconfig. You just need to define a new tool called
code and set it as the default merge tool.
Merge tool for Git Tower
If you use Git Tower as you GUI client for Git, adding Using Visual Studio Code as a merge tool is a bit more tricky, but there is documentation showing you how to do it. You need to create a
CompareTools.plist file in
~/Library/Application Support/com.fournova.Tower2/CompareTools/. This file contains definitions for all the custom diff and merge tools you want to use, not just Visual Studio Code.
The definition for Visual Studio Code may look like this
It calls a bash script
code.sh when invoked, that runs Visual Studio Code with the same parameters as in the Git merge tool definition in
.gitconfig, it is just referenced a differently.
Do not forget to make the bash script runnable by calling
chmod +x bash.sh.
When you restart Git Tower, you will now see Visual Studio Code among the merge tools options.