3
\$\begingroup\$

I'm having issues getting the UnityYAMLMerge tool to work, in order to fix conflicts merging a scene in 2 different branches (myBranch into dev). Here's what I've done:

  1. Set Asset Serialization to Force Text: In Edit > Project Settings > Editor menu, I set Force Text under Asset Serialization Mode. This has been set for the entire lifetime of the project so all applicable git-tracked files should have this setting.

  2. Treat the Files as Binary to Avoid Git Merging Them Automatically: created .gitattributes in project root dir with the following then pushed:

*.unity binary
*.prefab binary
*.asset binary
  1. Set up UnityYAMLMerge with Git: copypasted the following into .git/config:
[merge]
tool = unityyamlmerge

[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Tools/UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

Note: the Unity docs state that the UnityYAMLMerge.exe should exist at:

C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe

or

C:\Program Files (x86)\Unity\Editor\Data\Tools\UnityYAMLMerge.exe

However I do not have an Editor/ directory at either of these locations, and instead I found the executable at C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Tools/UnityYAMLMerge.exe (2019.2.17f1 does match the version of Unity I'm building this project in).


However after all this, when I am in my branch dev and try to merge my branch myBranch into dev, I still receive conflict warnings and am asked to manually fix them:

$ git merge myBranch
warning: Cannot merge binary files: Assets/Scenes/ManagerScene.unity (HEAD vs. myBranch)
warning: Cannot merge binary files: Assets/Scenes/2-Paint.unity (HEAD vs. myBranch)
warning: Cannot merge binary files: Assets/Resources/Prefabs/UI/Heatmap.prefab (HEAD vs. myBranch)
Auto-merging Assets/Scenes/ManagerScene.unity
CONFLICT (content): Merge conflict in Assets/Scenes/ManagerScene.unity
Auto-merging Assets/Scenes/2-Paint.unity
CONFLICT (content): Merge conflict in Assets/Scenes/2-Paint.unity
Auto-merging Assets/Resources/Prefabs/UI/Heatmap.prefab
CONFLICT (content): Merge conflict in Assets/Resources/Prefabs/UI/Heatmap.prefab
Automatic merge failed; fix conflicts and then commit the result.

From what I understand, the UnityYAMLMerge tool should automatically resolve these conflicts without causing git to prompt me to fix them. Is this correct? Otherwise, what else must I do to use this tool properly?

Thanks for any help!

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I was able to use the UnityYAMLMerge tool successfully by downloading a git GUI, specifically Sourcetree, and following along with this video. This gave me a clue as to how it may be successfully used via the command line: in Sourcetree, when you merge and get shown the conflicted files, you must launch the UnityYAMLMerge tool for each individual file in order to fix it; I imagine the same must be done via the command line but I do not know how just yet. If I ever find out later I will update this answer.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .