ABDiff Help

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

Diff

Tools ▸ Diff & Merge ▸ External Diff Tools
Tools ▸ Diff & Merge ▸ External Diff Tools

Sourcetree

Open the configuration with ⌘, then set

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>
EOF

If 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.sh

The 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:

4) Use ABDiff for conflicts

When Tower shows a conflicted file in the working copy:

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

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

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: