To configure Fork to use IntelliJ IDEA for diffing and merging, follow the steps below.
Ensure you have the command-line launcher idea installed.
- Path:
/usr/local/bin/idea - You can verify this by running
which -a ideain your terminal.
- Open Fork and go to Preferences / Settings (
Cmd + ,). - Select the Integration tab.
- Under External Diff Tool, select Custom... from the dropdown and click Edit... (or click Edit... if already selected).
- Configure the fields as follows:
- File Path:
/usr/local/bin/idea - Arguments:
diff $LOCAL $REMOTE
- File Path:
- Click Edit to save.
When merging files that were added in both branches independently (where no common base file exists), Fork passes an empty $BASE variable. To prevent IntelliJ IDEA from failing with a "Can't process file" error, we can delegate the merge to a lightweight custom wrapper script.
Create a file named idea-merge-fork (for example, in /usr/local/bin/idea-merge-fork or any other directory on your $PATH):
#!/bin/sh
if [ -f "$3" ]; then
/usr/local/bin/idea merge "$1" "$2" "$3" "$4"
else
/usr/local/bin/idea merge "$1" "$2" "$4"
fiMake the script executable:
chmod +x /path/to/idea-merge-fork- In Fork's Integration tab, under Merge Tool, select Custom... and click Edit....
- Configure the fields as follows:
- File Path:
/path/to/idea-merge-fork(replace with the absolute path to your script) - Arguments:
$LOCAL $REMOTE $BASE $MERGED
- File Path:
- Click Edit to save.
Now, whenever you perform a merge conflict resolution or want to view external diffs within Fork, it will launch IntelliJ IDEA with the correct files and UI windows automatically!