This page covers external tool integration for JetBrains IDEs, Sourcetree, Tower, and Visual Studio Code.
Jetbrains
Merge
Open the configuration with ⌘, then go to Tools ▸ Diff
& Merge ▸ External Diff Tools
Press (+)
Fill-in the following information in Add An External Tool
- Tool group: Merge tool
- Program path:
/path/to/abd - Tool name: ABDiff
- Argument pattern:
--base %3 --local %1 --remote %2 --result %4 - Press “Test Merge” to see if the merge completes.
- Press OK
Diff
- Press (+)
- Fill-in the following information in Add An External Tool
- Tool group: Diff tool
- Program path:
/path/to/abd - Tool name: ABDiff
- Argument pattern:
--local %1 --remote %2 - Press “Test Diff” to see if the diff completes.
- Press OK
Sourcetree
Open the configuration with ⌘, then set
- Merge Tool:
Custom… - Merge Command:
/path/to/abd - Arguments:
--base "$BASE" --local "$LOCAL" --remote "$REMOTE" --result "$MERGED"
Tower
This assumes you already installed
abd.
Tower supports custom external diff/merge tools on macOS through a
CompareTools.plist registration file and an executable
wrapper script.
The terminal command blocks below are meant to be copied and pasted
into Terminal as complete blocks. Do not type only the EOF
lines; paste the whole block from cat ... << 'EOF'
through the closing EOF.
1) Create the compare tools folder and plist
mkdir -p ~/Library/Application\ Support/com.fournova.Tower3/CompareTools
cat > ~/Library/Application\ Support/com.fournova.Tower3/CompareTools/CompareTools.plist << 'EOF'
<?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>dev.jano.apple.abdiff</string>
<key>ApplicationName</key>
<string>ABDiff</string>
<key>DisplayName</key>
<string>ABDiff</string>
<key>LaunchScript</key>
<string>abdiff.sh</string>
<key>Identifier</key>
<string>abdiff</string>
<key>SupportsMergeTool</key>
<true/>
<key>SupportsDiffChangeset</key>
<false/>
</dict>
</array>
</plist>
EOFIf CompareTools.plist already exists because you
configured other custom tools, merge the <dict> entry
into the existing top-level <array> instead of
overwriting the file.
2) Create the launch script
cat > ~/Library/Application\ Support/com.fournova.Tower3/CompareTools/abdiff.sh << 'EOF'
#!/bin/sh
ABD="$(command -v abd)"
if [ -z "$ABD" ] || [ ! -x "$ABD" ]; then
echo "ABDiff CLI 'abd' was not found in PATH" >&2
exit 128
fi
abs_path() {
case "$1" in
/*) printf '%s\n' "$1" ;;
*) printf '%s/%s\n' "$PWD" "${1#./}" ;;
esac
}
if [ "$#" -eq 2 ]; then
LOCAL=$(abs_path "$1")
REMOTE=$(abs_path "$2")
exec "$ABD" --local "$LOCAL" --remote "$REMOTE"
elif [ "$#" -eq 4 ]; then
LOCAL=$(abs_path "$1")
REMOTE=$(abs_path "$2")
BASE=$(abs_path "$3")
MERGED=$(abs_path "$4")
exec "$ABD" --base "$BASE" --local "$LOCAL" --remote "$REMOTE" --result "$MERGED"
else
echo "Unexpected argument count: $#" >&2
exit 1
fi
EOF
chmod +x ~/Library/Application\ Support/com.fournova.Tower3/CompareTools/abdiff.shThe opening delimiter is quoted so the shell does not expand the file contents while writing them. The closing delimiter stays unquoted because that is the form the shell expects.
3) Configure Tower
Open Tower ▸ Settings ▸ Git Config and set:
- Diff tool:
ABDiff - Enable Perform directory diff
- Merge tool:
ABDiff
4) Use ABDiff for conflicts
When Tower shows a conflicted file in the working copy:
- Right-click the conflicted file.
- Choose Open Merge Tool.
Tower will launch ABDiff for that conflict.
5) Test from Terminal
Test from Terminal in a Git repository:
git difftool --tool=tower path/to/file
git mergetool --tool=tower path/to/fileTower configures Git through its own tower tool entries,
so the verification commands above use --tool=tower even
though the custom tool identifier inside CompareTools.plist
is abdiff.
Notes
SupportsDiffChangesetisfalsebecause ABDiff opens one comparison window, not a whole multi-file changeset view.- The wrapper script looks up
abdfrom your currentPATH, so install it first with CLI Installation. - If you compare many changed files at once and prefer a directory-oriented flow, enable Tower’s Perform directory diff option in Settings ▸ Git Config.
Visual Studio Code
Install the ABDiff extension for VS Code from https://github.com/janodev/vscode-abd.
If you prefer not to install another extension, you can still resolve merge conflicts using VS Code:
- Launch the Merge editor by selecting a conflict and clicking Resolve in Merge Editor.
- Launch your configured Git merge tool by running
git mergetoolfrom the VS Code integrated terminal.