Skip to content

Instantly share code, notes, and snippets.

@aet
Created May 26, 2020 16:55
Show Gist options
  • Save aet/151e0b25f40a07264dd93b239aea3d65 to your computer and use it in GitHub Desktop.
Save aet/151e0b25f40a07264dd93b239aea3d65 to your computer and use it in GitHub Desktop.
Fix using Unity's UnityYAMLMerge with Apple File Merge (/usr/bin/opendiff) on a Mac
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
# Create /usr/local/UnityYAMLMerge directory (any other location will do)
# /usr/local/UnityYAMLMerge/UnityYAMLMerge is a symlink to a release of your choice, /Applications/Unity/Hub/Editor/XXX/Unity.app/Contents/Tools/UnityYAMLMerge
# Copy mergeresolving.txt, mergerules.txt and mergespecfile.txt from there and maintain possible customizations outside the core Unity installation
#
# For Mac, mergespecfile.txt has a configuration issue out of the box the way it uses Apple File merge (/usr/bin/opendiff), it doesn't block!
# Switch it to use this dummy wrapper instead:
#
# % cat /usr/local/bin/opendiff-w
# #!/bin/sh
# /usr/bin/opendiff "$@" | cat
#
# mergespecfile.txt:
# ..
# Apple File Merge
# * use "/usr/local/bin/opendiff-w" %r %l -ancestor %b -merge %d
#
cmd = /usr/local/UnityYAMLMerge/UnityYAMLMerge merge -p -i /usr/local/UnityYAMLMerge/mergeresolving.txt --rules /usr/local/UnityYAMLMerge/mergerules.txt --fallback /usr/local/UnityYAMLMerge/mergespecfile.txt \"$BASE\" \"$REMOTE\" \"$LOCAL\" \"$MERGED\"
trustExitCode = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment