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
⌘,. - Configure merge:
- Merge Tool:
Custom… - Merge Command:
abd - Arguments:
--base "$BASE" --local "$LOCAL" --remote "$REMOTE" --result "$MERGED"
- Configure diff:
- Visual Diff Tool: Custom…
- Diff Command:
abd - Arguments:
--local "$LOCAL" --remote "$REMOTE"
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.
1) Create the compare tools folder and plist
Copy this whole block to your Terminal, including the trailing
EOF.
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>
<true/>
</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
Copy this whole block to your Terminal:
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
LEFT=$(abs_path "$1")
RIGHT=$(abs_path "$2")
exec "$ABD" --local "$LEFT" --remote "$RIGHT"
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
When Tower compares two commits, it may pass two temporary directories instead of two files. ABDiff accepts that invocation and opens a read-only changeset view with the changed-file sidebar. This is not a folder-comparison tree.
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/file
abd changeset --repo /path/to/repo --left <commitA> --right <commitB>Tower 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
SupportsDiffChangesetistruebecause ABDiff now supports a read-only multi-file changeset view.- The wrapper script looks up
abdfrom your currentPATH, so install it first with CLI Installation. - The 2-argument wrapper covers both ordinary file diffs and Tower changeset launches. If Tower passes directories, ABDiff interprets them as a changeset, not a folder-comparison tree.
- Keep Tower’s Perform directory diff option enabled so Tower can hand over commit-to-commit snapshots as directories.
- For direct terminal launches, prefer
abd changeset --repo /path/to/repo --left <commitA> --right <commitB>.
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.