Merge Conflicts - ubco-video-game-development-club/rpg Wiki
Dealing with Asset Merge Conflicts in Unity
Often, when making a Pull Request (PR) into the
dev branch, you will find that your current changes conflict with new changes that have been made to the
dev branch. Normally these can be resolved easily within VSCode using its built-in merge conflict interface - however, if the conflicts are in an asset file, such as a Scene or a Prefab, you may be unable to resolve the conflict yourself. For these cases, we can resolve the vast majority of conflicts using UnityYAMLMerge.
Setting up UnityYAMLMerge
Go to your local folder where you installed the Unity project and ensure you have hidden folders set to visible in your file explorer (on Windows, this is under View -> Hidden Items). Open up the
.git folder and open the
config file with your preferred text editor (you can even use VSCode).
Anywhere in that file after existing items (yours may vary depending on your Git setup), add the following lines:
[merge] tool = unityyamlmerge [mergetool "unityyamlmerge"] trustExitCode = false cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\2020.2.1f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
Your file paths may vary, and this will need to be done for each Unity project you are working on.
Your project folder should now be configured to use UnityYAMLMerge. To use this, anytime you encounter a merge conflict involving an asset file such as
Main.unity, you can simply run the following command in the command line:
Note that you will have to run this in the base folder of the project, so ensure that you are in the correct directory - on Windows you can use this command before running
Feel free to ask in #rpg-discussion in the Discord server if you have any problems!
Thanks to this article for providing many of the details needed to setup this process.