I looked everywhere for documentation on this matter with little to no success. Unity's own documentation is very much incomplete when it comes to this dynamic. I am here to provide you with the only way I've been able to get it to work. Of course I would appreciate feedback on how this could be done better, but as it stands now nearly all Google searches on this topic are 2 years old or older.
The Unity docs say to add the following to the .git/config
:
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = '<path to UnityYAMLMerge>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
The vast majority of the community agrees with that, and also tell you to add either one of these to .gitattributes
:
*.unity binary
*.prefab binary
*.asset binary
or
* text=auto
# Unity files
*.meta -text merge=unityyamlmerge diff
*.unity -text merge=unityyamlmerge diff
*.asset -text merge=unityyamlmerge diff
*.prefab -text merge=unityyamlmerge diff
Neither of which work. I found many different alternatives to the blocks of code above. I looked for days, wasted a whole weekend even. Nothing will work and I can't find any current information on the matter.