Unity Repository Guide

Unity .gitignore: What to Commit and What to Ignore

Commit the Unity project sources required to reconstruct the project: Assets/ with .meta files, Packages/, and ProjectSettings/. Ignore generated caches, local editor state, build output, logs, and temporary files.

7 Wolves July 29, 2026 8 min read Git Setup

What a Unity repository should commit

  • Assets/: scripts, scenes, prefabs, materials, imported source assets, Editor tools, and matching .meta files.
  • Packages/manifest.json: direct package dependencies.
  • Packages/packages-lock.json: resolved dependency graph used by the project.
  • ProjectSettings/: Unity project configuration shared by the team.
  • Team tooling: CI workflows, scripts, documentation, and reproducible build configuration.

A fresh clone should be able to open the project, restore packages, import source assets, and reproduce the intended project configuration.

What to ignore

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
/[Mm]emoryCaptures/
*.log

Library/ is an imported cache that Unity can rebuild. Temp/, Obj/, logs, and build output are machine-generated. UserSettings/ contains local editor preferences that usually should not create team-wide churn.

Do not ignore these by mistake

  • *.meta files. They hold asset GUIDs and importer settings.
  • All *.asset files. Many ScriptableObjects and Unity configuration assets are project source.
  • The complete Packages/ directory. Its manifest and lock file are needed even if downloaded package caches are not.
  • Scenes, prefabs, materials, or shader files because they are noisy.
  • Project settings that happen to differ locally without first understanding why.

If asset identity changes are difficult to understand, MergeSight Unity project asset review can expose GUID, fileID, reference, hierarchy, and property changes while the real source and meta files remain tracked.

Use the maintained Unity template as a baseline

The GitHub github/gitignore repository maintains a Unity template covering common Unity caches, build output, IDE files, memory captures, and optional package exports. Start there, then add only project-specific generated paths.

Avoid copying a years-old snippet without review. Unity and tooling add new generated folders over time, and the current template documents why several patterns exist.

Ignoring a file does not untrack it

.gitignore affects intentionally untracked paths. If Library/ or another generated path is already committed, adding an ignore rule does not remove it from the index.

git rm -r --cached Library
git add .gitignore
git status --short

Review the staged deletion carefully before committing. Do not run broad cached removals against Assets/ or other source folders.

Verify a clean clone

  1. Clone the repository into a separate directory.
  2. Confirm that Git LFS objects are available if the project uses LFS.
  3. Open the project in the documented Unity version and wait for a full import.
  4. Check that packages resolve and scenes, prefabs, materials, and scripts are present.
  5. Run git status --short; a clean open should not generate a large unexplained diff.

If opening a clean clone rewrites many assets, investigate Unity version mismatch, serialization settings, platform-specific importer changes, or uncommitted project configuration before changing ignore rules.

FAQ

Should Unity Library be committed to Git?

No. Library is an imported cache that Unity rebuilds from project sources and settings. Committing it creates large, machine-specific churn.

Should Unity meta files be ignored?

No. Meta files contain asset GUIDs and importer settings. Commit each meta file with its matching asset or folder.

Which Unity folders should be committed?

Commit Assets, Packages manifest and lock files, ProjectSettings, and team-owned tooling needed to reproduce the project.

Why is an ignored Unity file still tracked?

Gitignore does not affect files already in the index. Remove the generated path from the index with a carefully scoped git rm --cached command, then commit the change.

Summary

Commit project sources

Assets with meta files, Packages, ProjectSettings, and team tooling define the project.

Ignore generated state

Library, Temp, Obj, builds, logs, and local UserSettings should stay outside Git.

Test a clean clone

A reproducible import is the strongest proof that the boundary is correct.

A good Unity .gitignore removes machine-generated noise without hiding any file required for identity, import, configuration, or collaboration.

Next step

Combine this repository boundary with the storage and merge rules in the complete Unity Git setup.