• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by guiquadros · Mar 18, 2017 at 09:02 AM · visual studiomergegithub

Unity Smart Merge (UnityYAMLMerge.exe): how to configure vsDiffMerge.exe in the mergespecfile.txt?

Hello,

I am using GitHub as my repository and I want to use vsDiffMerge.exe as my fallback merge tool. I tried to configure it in mergespecfile.txt as:

* use "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe" "$LOCAL" "$REMOTE" "$BASE" "$MERGED" //m

and as:

* use "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe" "%r" "%l" "%b" "%d"

The first command does not work at all. The second command does just the diff (not the merge operation - more information here) and I tried to add the //m in the end, but same thing, it just does the diff.

In SourceTree, I have the UnityYAMLMerge.exe correctly configured:

Merge Tool = Custom

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

Arguments = merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

The YAML merge (scene and prefabs) works well, but the problem is to launch the fallback tool for scripts.

By the way, if I configure the vsDiffMerge.exe directly in SourceTree like below it works well for the scripts (but for YAML not of course - I want to use the UnityYAMLMerge.exe for prefabs and scenes as the default merge tool, not vsDiffMerge.exe):

Merge Tool = Custom

Diff command = C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe

Arguments = "$LOCAL" "$REMOTE" "$BASE" "$MERGED" //m

Nowadays, I keep switching between those configurations in SourceTree (when I need to merge scripts I put vsDiffMerge.exe, when I need to merge YAML I put UnityYAMLMerge.exe), but this is not productive and the mergespecfile.txt should work.

By the way, I could configured successfully p4Merge in mergespecfile.txt, but I prefer vsDiffMerge.exe :)

alt text

alt text

yaml-merge.png (25.6 kB)
vs-merge.png (26.0 kB)
Comment
jethrogillgren

People who like this

1 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image

Answer by andrasgabor · Oct 15, 2018 at 05:58 PM

I created a proxy script as:

 o:\git\tools\vsmerge.bat


Content:

 "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe" /m "%1" "%2" "%3" "%4" 


I am invoking this from mergefilespec.txt:

  * use "o:\git\tools\vsmerge.bat" "%r" "%l" "%b" "%d"


It did not work without the proxy script. This way though the merge button works in the team explorer from VS for code.

Comment
EyePD
LucasSupportSquare

People who like this

2 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image EyePD · Aug 21, 2019 at 07:32 PM 0
Share

Nice workaround. Here's my attempt at TortoiseGitMerge:

 * use "c:\util\yamlmerge-tortoisemerge.bat" "%b" "%l" "%r" "%d"
 
 "C:\Program Files\TortoiseGit\bin\TortoiseGitMerge.exe" /base:%1 /mine:%2 /theirs:%3 /merged:%4



avatar image

Answer by guiquadros · Mar 29, 2017 at 06:23 PM

I found a solution that worked for me (although I could not correctly configure the mergespecfile.txt file to use vsDiffMerge.exe):

in .gitconfig I added an addition entry:

 [mergetool "vs"]
     cmd = 'C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe' $LOCAL $REMOTE $BASE $MERGED //m
     trustExitCode = true

And in the console I run:

For .prefab and .unity:

 git mergetool

For .cs:

 git mergetool --tool=vs

If I need to run for a specific file:

 git mergetool --tool=vs *<file_name>.cs

Here is my whole merge/diff configuration in the .gitconfig file:

 [mergetool "vs"]
     cmd = 'C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe' $LOCAL $REMOTE $BASE $MERGED //m
     trustExitCode = true
 
 [difftool "sourcetree"]
     cmd = 'C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe' $LOCAL $REMOTE Source Target //t
 [mergetool "sourcetree"]
     cmd = 'C:/Program Files/Unity5.5.1f1/Editor/Data/Tools/UnityYAMLMerge.exe' merge -p $BASE $REMOTE $LOCAL $MERGED
     trustExitCode = false
     keepTemporaries = true
     keepBackup = false
 
 [merge]
     tool = sourcetree
 [diff]
     tool = sourcetree
     
 [core]
     autocrlf = true

So, this solved my merge issues with the .cs files (which was my main merge configuration problem). But my fallback tool in the mergespecfile.txt is still p4merge (which does not bother me so much to solve unsolved scene and prefab conflicts the Unity Smart merge could not handle):

 unity use "C:\Program Files\Perforce\p4merge.exe" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
 prefab use "C:\Program Files\Perforce\p4merge.exe" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
 
 # Perforce merge
 * use "%programs%\Perforce\p4merge.exe" "%b" "%l" "%r" "%d"
 * use "%programs%/p4merge.app/Contents/Resources/launchp4merge" "%b" "%l" "%r" "%d"

If anyone knows how to configure the mergespecfile.txt to work with the vsDiffMerge.exe as the fallback tool I would like to see the solution.

Comment

People who like this

0 Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image $$anonymous$$ · Jun 10, 2018 at 12:28 PM 0
Share

Hey, I know this post is more than a year old, but I'll take my chances. I'm currently experiencing the very same issue - cannot configure vsDiffMerge to act as a fallback tool properly. Did you get it solved by any chance?

avatar image guiquadros · Jun 10, 2018 at 07:27 PM 0
Share

Hello @$$anonymous$$, the answer is no. I still running “git mergetool --tool=vs myFile.cs” for code merges (.cs files) and “git mergetool myFile.prefab” for prefabs and scenes. When the Smart Merge fails to merge a prefab or scene another fallback tool (not VS) is called to solve the conflict (I was using p4merge, but now I am trying WinMerge). So I am still unable to use Visual Studio as a fallback tool for the Smart Merge.

avatar image EyePD guiquadros · Aug 21, 2019 at 06:08 PM 0
Share

The nice thing with WinMerge is that it's command line will accept dashes instead of forward slashes which gets around the YAMLMerge issue. Unfortunately I've not yet figured out the right set of command line options.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

97 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Visual Studio / Git / Unity - All files and folders I add are going into untracked files - why? 1 Answer

Option to generate cproj files doesn't appear despite having IDE chosen, and having updated package manager 0 Answers

Which is the easiest way to access google play games services from our game ? 0 Answers

Merging two Gameobjets into one! 1 Answer

Javascript visual studio problem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges