Skip to content

Instantly share code, notes, and snippets.

@adammyhre
Last active December 2, 2025 12:19
Show Gist options
  • Select an option

  • Save adammyhre/6b5165bb57706ebb35eb4c600604b42a to your computer and use it in GitHub Desktop.

Select an option

Save adammyhre/6b5165bb57706ebb35eb4c600604b42a to your computer and use it in GitHub Desktop.
# Unity text-based assets that are safe for Smart Merge / YAMLMerge
*.unity merge=unityyamlmerge
*.prefab merge=unityyamlmerge
*.mat merge=unityyamlmerge
*.physicMaterial merge=unityyamlmerge
*.physicsMaterial2D merge=unityyamlmerge
*.controller merge=unityyamlmerge
*.anim merge=unityyamlmerge
*.overrideController merge=unityyamlmerge
*.mask merge=unityyamlmerge
# IMPORTANT:
# Do NOT use YAMLMerge on .asset files.
# Although some .asset files are YAML-based, others (e.g., LightingData.asset)
# are binary and will be corrupted if YAMLMerge is applied.
# Unity’s own documentation specifies YAMLMerge is only safe for .unity and .prefab files.
#*.asset merge=unityyamlmerge # ← commented out on purpose
# Meta files should use "ours" to avoid merge conflicts
*.meta merge=ours
[user]
email = [email protected]
name = Adam
[core]
editor = 'C:/Program Files/JetBrains/JetBrains Rider 2025.2.0.1/bin/rider64.exe' --wait
autocrlf = false
excludesfile = ~/.gitignore_global
# ── Rider for diffs & fallback merge ─────────────────────────────────────
[diff]
tool = rider
[difftool "rider"]
cmd = 'C:/Program Files/JetBrains/JetBrains Rider 2025.2.0.1/bin/rider64.exe' diff "$LOCAL" "$REMOTE"
[mergetool "rider"]
cmd = 'C:/Program Files/JetBrains/JetBrains Rider 2025.2.0.1/bin/rider64.exe' merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
trustExitCode = true
# ── Unity Smart Merge (6000.x) ───────────────────────────────────────────
[merge]
tool = unityyamlmerge
# optional - use the merge driver or the mergetool cmd, probably not both
[merge "unityyamlmerge"]
driver = 'C:/Program Files/Unity/Hub/Editor/6000.2.14f1/Editor/Data/Tools/UnityYamlMerge.exe' merge -p --force %O %A %B
recursive = binary
[mergetool]
keepBackup = false
[mergetool "unityyamlmerge"]
trustExitCode = true
cmd = 'C:/Program Files/Unity/Hub/Editor/6000.2.14f1/Editor/Data/Tools/UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
[alias]
# ── Checkout & branches ─────────────────────
co = checkout
cb = checkout -b # new branch + switch
br = branch -vv --color --sort=-committerdate
wt = worktree
# ── Commit workflow ─────────────────────────
ct = commit
ci = commit
ca = commit --amend
cane = commit --amend --no-edit
unstage = reset HEAD --
undo = reset --soft HEAD^ # shorter name for undo-commit
# ── Diff & visual tools ─────────────────────
di = diff # old habit
df = diff # new habit
ds = diff --staged # aka diff --cached
dt = difftool # opens Rider
mt = mergetool # UnityYAMLMerge
# ── Status & log ────────────────────────────
st = status -sb
last = log -1 HEAD
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lol = log --graph --oneline --decorate
[color]
ui = auto
[rerere]
enabled = true
[init]
defaultBranch = master
[pull]
rebase = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[safe]
directory = *
Unity YAML Merge Tool for scene or prefab files - version 1.0.1
usage: UnityYAMLMerge merge [-l|-r|-p|-h] [-i file] [-o file]
[--rules rulesfile]
[--fallback fallbackspecfile]
[--force] [--nomappinginoneline] [--describe]
<base> <left> <right> [dest]
[premerge base dest] [premerge right dest]
UnityYAMLMerge strip <left> <right>
-l Resolve merge conflicts using left (theirs)
-r Resolve merge conflicts using right (mine)
-i file Resolve merge conflicts using merge file
-o file File to write merge conflicts into
-p Use premerging
-h Use 'headless' mode (no error dialogs)
--rules A files with merge rules
--typeInfo A file with type information on objects in asset files
--fallback Spec file defining fallback tools on conflicts if not using
builtin. Can be set to 'none' to disable fallback.
--force Force merging even on unknown file extensions
--nomappinginoneline Force line break when the length exceeds 80 characters.
--describe Include description of what has been done in the -o file.
The -l and -r options will first try to use the -i file if provided to
determine how to resolve and next fallback to either left, right
or base (default).
This is useful for using this tool as a first premerge pass before running
another merge tool as fallback.
For doing a normal premerge use the -p option. This will create a new left
(theirs) file that contains all non-conflicting merges and the left side
values for where there are conflicts. The same will be done the base file and
right file and put into a temporary file unless [premerge base dest] /
[premerge right dest] is specified in which case that will be used instead.
As a result the fallback merge tool will not show the original left,right or base
files but the premerged ones which contains only conflicts that this tool
could not handle.
The fallback tool does not use any of the options. Unity ships with a default
fallback specfile that is used if nothing else is specified. Unity also ships
with a default rules file that is used if nothing else is specified.
In order to be able to use this tool with subversion any invocation with 1st
argument not 'merge' is taken as being called from subversion which
hard codes parameters.
There is also an experimental 'diff' command which takes two files and outputs
the changes between the two files in a custom format. Do not rely on this
format to be stable as it will likely change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment