Unity Git Setup
Unity Git Setup for Teams: LFS, Smart Merge, and Asset Workflows
A reliable Unity Git setup has six parts: text serialization, visible and committed .meta files, a Unity-specific .gitignore, Git LFS for large binary source assets, a Unity-aware merge driver for text assets, and a review and validation workflow for scenes and prefabs.
1. Configure the Unity project baseline
Set Asset Serialization to Force Text so Unity-created scenes, prefabs, materials, and many .asset files remain inspectable. Use Visible Meta Files for an external VCS workflow and commit every asset together with its matching .meta file.
The repository should normally contain:
Assets/, including source assets and all relevant.metafiles.Packages/manifest.jsonandPackages/packages-lock.json.ProjectSettings/.- Team-owned build, tooling, and CI files required to reproduce the project.
Do not commit generated folders such as Library/, Temp/, Obj/, Logs/, or local UserSettings/.
2. Separate text merge rules from binary storage rules
Use .gitattributes to describe how Git should treat each path. Unity YAML assets should remain text and can use UnityYAMLMerge or another Unity-aware driver. Large, non-mergeable source files should use Git LFS.
*.unity text eol=lf merge=unityyamlmerge
*.prefab text eol=lf merge=unityyamlmerge
*.asset text eol=lf merge=unityyamlmerge
*.mat text eol=lf merge=unityyamlmerge
*.psd filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
Do not put .unity, .prefab, .asset, .mat, or .meta files into LFS by default. Doing so replaces their useful text content in Git with pointer files and removes the normal text diff and Smart Merge path.
3. Use Git LFS for the right assets
Track files because they are large and binary, not simply because they live under Assets/. Typical candidates include high-resolution textures, layered art files, 3D source models, audio, video, and other non-mergeable originals.
git lfs install
git lfs track "*.psd"
git lfs track "*.fbx"
git add .gitattributes
Agree on extensions before the repository grows. Adding LFS rules does not migrate objects already stored in Git history; a history migration is a separate, disruptive operation that should be planned and tested.
4. Configure Smart Merge and semantic review
UnityYAMLMerge is the built-in baseline for combining text-serialized scenes and prefabs. Configure it through a tracked attribute rule and each developer's Git config, then test the executable path for every installed Unity version.
Smart Merge can complete many non-overlapping changes, but its output is not a complete review surface. A MergeSight Git-aware review and merge workflow can show branch, commit, and working-tree changes as Unity objects, components, properties, hierarchy, references, and explicit Base / Ours / Theirs decisions.
5. Add selective locking
Use file locking for assets that cannot be merged or whose parallel editing cost is consistently higher than coordination. Binary art source files are the clearest candidates. Large, high-risk scenes may also be locked during specific work, but blanket locking of all text-serialized scenes and prefabs can unnecessarily reduce parallel development.
Make the policy visible: define which extensions are always locked, which assets require a temporary ownership message, and who can release abandoned locks.
6. Define the daily team workflow
- Update the branch before opening a shared scene or prefab.
- Acquire required locks or announce ownership for high-risk assets.
- Make a focused change and save only intended assets.
- Review
git statusand a semantic diff before committing. - Commit matching
.metafiles and explain structural asset changes. - Open a pull request with scene/prefab reviewers and automated asset checks.
- Merge short-lived branches before they drift far from the target branch.
Verify the setup on every workstation
git check-attr -a -- Assets/Scenes/World.unity
git check-attr -a -- Assets/Art/Character.psd
git lfs env
git config --get-regexp '^merge\.'
git status --short
Run a disposable test that changes the same scene or prefab on two branches. Confirm that Git invokes the intended driver, unsafe conflicts remain visible, LFS files download correctly, and the project still opens in Unity.
FAQ
What folders should a Unity Git repository include?
Commit Assets with meta files, Packages manifest and lock files, ProjectSettings, and team-owned tooling. Ignore generated Library, Temp, Obj, Logs, builds, and local UserSettings folders.
Should Unity scenes and prefabs use Git LFS?
Usually no. Text-serialized scenes and prefabs benefit from normal Git diffs and Unity-aware merge drivers. Use LFS primarily for large binary assets unless the team deliberately chooses a lock-only tradeoff.
Does Git work well for Unity teams?
Yes, when the team configures meta files, Force Text, a Unity-specific gitignore, LFS for large binaries, merge rules for Unity YAML, and a clear review and locking policy.
Is UnityYAMLMerge enough for a team workflow?
It is a useful automatic merge baseline, but teams still need review, explicit handling of ambiguous conflicts, Unity validation, CI checks, and ownership or locks for non-mergeable assets.
Summary
Store the right files
Commit Assets, meta files, Packages, and ProjectSettings; ignore generated local state.
Route by asset type
Keep Unity YAML as text, move large binaries to LFS, and lock only where coordination wins.
Verify the workflow
Test drivers, LFS, review, Unity import, and CI before the first real conflict.
Git becomes a dependable Unity workflow when storage, merge behavior, review, and team coordination are configured as one system.
Next step
Implement the exact path rules with the Unity .gitattributes guide, then verify them with git check-attr.