This content will be retired soon
This learning content is being retired and may no longer be available in the future. Consider completing it soon or checking out newer learning resources.

Working with YAMLMerge
Tutorial
advanced
+10XP
5 mins
(9)
Unity Technologies

YAMLMerge (unityyamlmerge.exe) is a tool that is included with the Unity Editor and works with version control software to merge Scene and Prefab files. In this workflow, we’ll configure Git to use YAMLMerge.
1. Configuring Git to user YAMLMerge
If you’d like to configure a different tool for use with YAMLMerge, please see the Unity Manual. YAMLMerge can also be run directly from the command line.
- Open your .gitconfig file. This is typically in your user/home directory.
- At the end, type:
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.2.11f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"- The path to Unity will vary depending on your platform, version number, and whether you’ve installed Unity directly or through the hub.
2. Configuring your Unity project
- From the Edit drop-down in the Unity Editor, select Project Settings.
- Click on Editor.
- Under Version Control, set Mode to Visible Meta Files if it’s not set already (Figure 01).
- Set Asset Serialization to Force Text if it’s not set already (Figure 01).
3. Usage and advanced options
When there’s a merge conflict, open Git Bash and type: git mergetool
When invoking YAMLMerge directly from the command line, you can specify which version of a file to keep by using -l or -r. You can also premerge by using the -p switch, and enable headless mode (suppress all error dialogs) by using -h. For more information on these options, invoke unityyamlmerge from the command line with no additional parameters.
4. Conclusion
This has been a brief introduction to YAMLMerge, a tool that is included with Unity to resolve merge conflicts when using version control with your projects.