A common problem when working with Unity is when 2 or more developers are modifying a Unity scene or prefab (*.unity files). Git does not know how to merge them correctly out of the box.
Thankfully the Unity team deployed a tool called SmartMerge which makes simple merge automatic.
The first thing to do is to add the following lines to your
%USERPROFILE%\.gitconfig, Linux/Mac OS X:
[merge] tool = unityyamlmerge [mergetool "unityyamlmerge"] trustExitCode = false cmd = '<path to UnityYAMLMerge>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
On Windows the path to UnityYAMLMerge is :
C:\Program Files (x86)\Unity\Editor\Data\Tools\UnityYAMLMerge.exe
and on MacOSX :
Once this is done, the mergetool will be available when conflicts arise during merge/rebase. Don't forget to run
git mergetool manually to trigger UnityYAMLMerge.