Search Unity

UnityYAMLMerge for Git on Windows

Discussion in 'Formats & External Tools' started by Noxwill, Apr 21, 2015.

  1. Noxwill

    Noxwill

    Joined:
    Apr 16, 2013
    Posts:
    18
    Can someone who's hooked up Unity's Smart Merge on Git for windows explain how they did it?

    I'm placing this in my .gitconfig:

    [merge]
    tool = unityyamlmerge
    [mergetool "unityyamlmerge"]
    trustExitCode = false
    cmd = '<C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

    But this is giving me a fatal error on the cmd line in the gitconfig.

    Anyone?

    EDIT: For anyone wondering, the slashes weren't correct... derp. Just ran into a "couldnt load spec file 'auto'" problem now though which makes Smart Merge inconsistent, but it apparently is fixed for the next update.
     
    Last edited: May 7, 2015
  2. Clint.Carpenter

    Clint.Carpenter

    Joined:
    Apr 28, 2015
    Posts:
    4
    Thank you for the help with slash vs. backslash this was stopping me too.

    Did you get the tool to actually merge unity files? I am past the error, but still getting Merge conflicts with local and remote changes to a .unity scene file.
     
  3. Noxwill

    Noxwill

    Joined:
    Apr 16, 2013
    Posts:
    18
    Yeah once you set it up in the config to specifically use Unity's Smart Merge (in your gitconfig file), once you get a merge conflict, I just use the git merge command in the console and it will use Unity's tool since you set it up for it.

    You should see it being processed in the console, it will solve the conflict, then it will ask you if it did it properly (y/n?), you go in Unity to check if it did it properly and reload your scene to see what it did, and if it worked properly you should see whatever changes were conflicted being solved, and if not, your scene should be corrupted so it'll be empty.

    Once you answer yes, it'll be solved, otherwise a no will still present you with a merge conflict you have to fix.

    But as of now, the smart merge is bugged and inconsistent. Sometimes it will work, but most times in a complicated conflict, it will fail.

    A dev in another post has been fixing all these errors and they're set to be in some future update.

    So at the latest it's in 5.1, but it might be in a 5.0.x release.

    http://forum.unity3d.com/threads/smart-merge-not-working.315903/

    I've gotten it to work on Git's end of things, now it's just bugging out with the tool itself. So just gotta wait for a new Unity update with the included fixes for it.

    For example, a small merge conflict like another GameObject being added will work consistently with Smart Merge, but once I try to add several GOs to the scene and present it with that conflict, the tool will throw up that 'couldn't load file auto' error. Luckily the tool has an option to offer backup scenes even if it craps out, so it will save a scene for pre-merge, post-merge, and 1 backup scene of both sides (total of 4 scene backups).

    But yeah, just wait for the next update that contains the fixes and work on separate scene files until then. Or work on the same scene file but not at the same time as your team members.
     
    Last edited: Jun 2, 2015
  4. YarivAtias

    YarivAtias

    Joined:
    Feb 27, 2017
    Posts:
    2
    Can someone help me set UnityYAMLMerge to merge '.asset file?

    In Unity I set the 'Asset Serialization' mode to 'Force Text' and I am using UnityYAMLMerge to merge '.prefab' '.scene' files.

    Now, I need UnityYAMLMerge to merge '.asset' files, assuming it is possible because '.asset' file format are YAML as well.

    Unfortunately I get the following error when I am trying to do that:

    errorUnity.png

    I already tried to add the line '*.asset merge=unityyamlmerge' to .gitattributes file but the error popup still appears.

    using Unity version 5.5.2f1, Windows 64 bit. Thanks in advance
    Thanks a lot