Skip to content

Instantly share code, notes, and snippets.

@troyfontaine
Forked from igorkulman/CompareTools.plist
Last active June 5, 2024 18:30
Show Gist options
  • Save troyfontaine/cbbff9b43580f1ee6f4e4a454322eb87 to your computer and use it in GitHub Desktop.
Save troyfontaine/cbbff9b43580f1ee6f4e4a454322eb87 to your computer and use it in GitHub Desktop.
Visual Studio Code as a merge tool for Git Tower.

Enable Visual Studio Code for Merge/Diff on Windows

From PowerShell or CMD:

cd C:\Program Files (x86)\fournova\Tower\CompareTools
code .

Edit VisualStudioCode.json and replace line 10 which is:

    "%ProgramW6432%\\Microsoft VS Code\\Code.exe",

With

    "C:\\Program Files\\Microsoft VS Code\\Code.exe"

Code will throw an error saving because it requires local admin permissions, use the "Retry as admin" button in the UI and the file should save. You can now open Tower and select Visual Studio code as your Diff and Merge tool.

Enable Visual Studio Code for Merge/Diff on macOS

  1. Create the required directory which doesn't exist by default. Note: this directory is the same for both Tower3 AND Tower4.
mkdir -p ~/Library/Application\ Support/com.fournova.Tower3/CompareTools/
  1. Copy CompareTools.plist, gitconfig and code.sh to ~/Library/Application Support/com.fournova.Tower3/CompareTools/
  2. Restart Git Tower
#!/bin/sh
code --wait "$4"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>ApplicationIdentifier</key>
<string>com.microsoft.VSCode</string>
<key>ApplicationName</key>
<string>Visual Studio Code</string>
<key>DisplayName</key>
<string>Visual Studio Code</string>
<key>LaunchScript</key>
<string>code.sh</string>
<key>Identifier</key>
<string>code</string>
<key>SupportsMergeTool</key>
<true/>
<key>SupportsDiffChangeset</key>
<false/>
</dict>
</array>
</plist>
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait "$MERGED"
@justsanjit
Copy link

This does not seems to be working. When I try to compare changes for two branches, tower crashes.

@troyfontaine
Copy link
Author

This does not seems to be working. When I try to compare changes for two branches, tower crashes.

On which OS?

@davut
Copy link

davut commented May 9, 2024

macOS 14.4.1 sonoma, does not work. Tower crashes as mentioned above

@rabbithops
Copy link

Tower doesn't crash for me, but I do see this error message from Tower after following all steps above:

Screenshot 2024-05-14 at 10 34 38 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment