Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save starikcetin/b7a7e707580cbb52f53a2a679b08c9be to your computer and use it in GitHub Desktop.
Save starikcetin/b7a7e707580cbb52f53a2a679b08c9be to your computer and use it in GitHub Desktop.
Configuring Unity YAML Merge KDiff3 and Git on Windows

Caution

Edit the paths to point towards your own installations.

Caution

Some paths use backslashes and others use forward slashes. Take notice of how I have given them below.

  1. Add this to your .gitconfig, it is under %homepath%:
[mergetool "unityyamlmerge"]
	cmd = "'C:/Program Files/Unity/Hub/Editor/6000.0.28f1/Editor/Data/Tools/UnityYAMLMerge.exe'" merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
[mergetool "kdiff3"]
	cmd = "'C:/Program Files/KDiff3/kdiff3.exe'" --auto "$REMOTE" -b "$BASE" "$LOCAL" -o "$MERGED"
[difftool "kdiff3"]
	cmd = "'C:/Program Files/KDiff3/kdiff3.exe'" --auto "$REMOTE" "$LOCAL"
[mergetool]
	prompt = false
	trustExitCode = false
	keepBackup = false
	keepTemporaries = false
[difftool]
	prompt = false
	trustExitCode = false
	keepBackup = false
	keepTemporaries = false
[merge]
	tool = unityyamlmerge
[diff]
	tool = kdiff3
  1. Get an appropriate .gitattributes file to instruct git which files should use the unityyamlmerge merge tool. I recommend this.

  2. Add this to mergespecfile.txt, it is in the same folder as the UnityYAMLMerge.exe:

# KDiff3
* use "C:/Program Files/KDiff3/kdiff3.exe" --auto "%r" -b "%b" "%l" -o "%d"
  1. If you are using Fork, open settings.json, it is in the Fork installation folder. Find the MergeTool and ExternalDiffTool keys and make them look like this:
  "MergeTool": {
    "Type": "UnityYAMLMerge",
    "ApplicationPath": "C:\\Program Files\\Unity\\Hub\\Editor\\6000.0.28f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe"
  },
  "ExternalDiffTool": {
    "Type": "KDiff3",
    "ApplicationPath": "C:\\Program Files\\KDiff3\\kdiff3.exe"
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment