Search Unity

Using VisualStudio build in merge tool alongside UnityYamlMerge

Discussion in 'Editor & General Support' started by jtsmith1287, Aug 27, 2015.

  1. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    I've got yaml merge working but now my normal CS merging is broke.

    Right now my config file for git has this added:

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

    And now in Visual Studio I can click the Merge button during scene/prefab conflicts (Found in the Team Explorer tab) and it uses unityyamlmerge and works great! However if I click merge with a C# file selected it still tries using unityyamlmerge and of course fails. So I did some research and added the following to my mergespecfile.txt:

    cs use "%programs%\Microsoft Visual Studio 12.0\Common7\IDE\vsDiffMerge.exe" "%r" "%l" "%b" "%d"

    This ALMOST works. It opens the file and shows the diff in Visual Studio, except normally you're able to click a check mark on which sections you'd like to keep and then accept the merge, where visual studio handles the rest. All I'm getting from this however is just the diff and no merging.

    Can anyone with Visual Studio experience or a Unity dev help me out? Thanks in advance!
     
  2. jdrewsen

    jdrewsen

    Unity Technologies

    Joined:
    Mar 28, 2011
    Posts:
    204
    I have no experience in using VS builtin merge tools but have you tried explicitly setting the merge tool for the .unity/.prefab suffixes:

    1, Open "Tools -> Options..." in VS
    2, Goto "Source Control -> Visual Studio Team Foundation Server -> Configure User Tools..."
    3, Click "Add.."
    4, Set UnityYAMLMerge as the merge tool for .unity and .prefab files
    5, Probably remove mergetool config settings from the .git config
     
  3. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Well now I just feel dumb. I don't know why I didn't consider doing it from visual studio in the first place. Thanks! I'll give this a go.