Game Dev Cheat Sheet

Unity .gitignore and Git for Game Development

.gitignore templates for Unity, Unreal, and Godot, Git LFS setup, workflows, and large binary strategies. The Unity template is explained block by block.

Version control for games is harder than for web or mobile apps because game projects contain large binary files (textures, models, audio) that Git was not designed for. This guide covers the essential setup: .gitignore templates for Unity, Unreal and Godot, what each block of the Unity template excludes and why, the two things a bare template cannot tell you (Unity's .meta files must be committed, and ignoring a folder does nothing once Git already tracks it), Git LFS for binary assets, and the workflows most game teams use daily.

.gitignore Templates

Unity .gitignore
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
*.pidb.meta
*.pdb.meta
*.mdb.meta
crashlytics-buildid.txt
sysinfo.txt
*.apk
*.aab
*.unitypackage
*.app

What each block excludes

Generated folders

[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/

Unity rebuilds all of these from your assets and project settings. Library is the import cache and is usually the largest folder in the project by a wide margin, often several gigabytes. UserSettings holds per-developer editor layout and preferences, so sharing it just overwrites your teammates' window arrangements. The bracket notation matches both capitalisations, because Unity has used both over the years and Git is case-sensitive on Linux and on case-sensitive macOS volumes.

IDE and solution files

*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs

Unity regenerates the C# project and solution files from your assembly definitions and package list on every reimport. Two developers with an identical project will produce different files, so committing them creates conflicts that resolve to nothing useful. Anyone opening the solution gets a freshly generated copy.

Debug symbols and editor caches

*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
*.pidb.meta
*.pdb.meta
*.mdb.meta

Debug symbol databases and editor caches, all regenerated on compile. Note the .meta entries here: these are the exceptions to the rule that .meta files must be committed, because the assets they describe are themselves ignored. A .meta file for an ignored asset is meaningless.

Crash and diagnostic reports

crashlytics-buildid.txt
sysinfo.txt

Written per machine and per build. crashlytics-buildid.txt changes on every build when Firebase Crashlytics is installed, which makes it a permanent source of noise in your diff.

Build output

*.apk
*.aab
*.unitypackage
*.app

Compiled builds and exported packages. These are large binaries that change completely each time, so Git cannot delta-compress them and the repository grows by the full size on every commit. Publish them as CI artefacts or releases instead.

Commonly added extras

Situational, so they are not in the base template. Add the ones that match your team's tools.

Editor and OS clutter

.vs/
.idea/
.vscode/
*.swp
.DS_Store
Thumbs.db

Per-developer IDE state and operating system metadata. .DS_Store on macOS and Thumbs.db on Windows appear in every folder anyone browses, so they are worth excluding globally as well as per project.

Recordings and profiling captures

MemoryCaptures/
Recordings/
[Cc]rashlytics/

Memory Profiler captures and Recorder output are large, local, and rarely useful to anyone else. Add these if your team uses those tools, otherwise the folders never appear.

Asset Store tooling

Assets/AssetStoreTools*
Assets/Plugins/Editor/JetBrains*

Publisher tooling that Unity drops into Assets and that should not travel with the project. Note these sit inside Assets, so their .meta files are ignored automatically by the trailing wildcard.

Commit your .meta files

This is the mistake that costs the most time, because the damage shows up later and looks random. Every asset in Unity has a companion .meta file holding its GUID, and every reference in your scenes, prefabs and materials points at that GUID rather than at a file path. Ignore .meta files and each developer generates different GUIDs for the same asset, so references that work on your machine resolve to nothing on everyone else's. Missing script references and unassigned materials are the usual symptoms.

Edit
Project Settings
Editor
Version Control
Visible Meta Files

Set Asset Serialization to Force Text in the same panel. Scenes and prefabs are then written as YAML rather than binary, which is what makes them diffable and merge-able at all.

The template above ignores three .meta patterns (*.pidb.meta, *.pdb.meta, *.mdb.meta). Those are the exception, not the rule: the assets they describe are themselves ignored, so their .meta files describe nothing.

Library is already committed. Now what?

.gitignore only prevents untracked files from being added. It has no effect on files Git already tracks, which is why adding Library to .gitignore appears to do nothing on an existing repository. Stop tracking it explicitly:

# Stop tracking, but keep the folder on disk
git rm -r --cached Library
git rm -r --cached Temp obj Build Builds Logs UserSettings

git commit -m "Stop tracking Unity generated folders"
git push

The --cached flag is what keeps your local files. Without it you delete the folders from disk as well, which is recoverable for Library, since Unity rebuilds it, but not for anything you meant to keep. Teammates receive the deletion on their next pull and their local Library rebuilds automatically on the next Editor launch.

Check what is actually tracked before and after:

# List tracked files that your .gitignore now excludes
git ls-files --cached --ignored --exclude-standard

# Confirm a specific path is ignored, and by which rule
git check-ignore -v Library/somefile

Removing the folders from the current commit does not shrink the repository, because the history still contains every version. If the clone size is the problem you need to rewrite history with git filter-repo, which changes every commit hash and requires all collaborators to re-clone. Worth it on a repository that has grown to gigabytes; not worth it otherwise.

What must stay in the repository

Excluding too much is as damaging as excluding too little, and harder to notice. These are not optional:

  • Assets/ and every .meta file inside it. Your entire project.
  • ProjectSettings/. Input axes, physics layers, quality levels, player settings, tags. The project behaves differently without it, and the differences are subtle enough to waste a day.
  • Packages/manifest.json and Packages/packages-lock.json. These pin your package versions. Without the lock file, teammates can silently resolve different versions.

Note that UserSettings/ is ignored while ProjectSettings/ is committed. The names are similar and the consequences of confusing them are not.

Git LFS Setup

LFS track commands
git lfs install
git lfs track "*.png"
git lfs track "*.jpg"
git lfs track "*.psd"
git lfs track "*.tga"
git lfs track "*.wav"
git lfs track "*.mp3"
git lfs track "*.ogg"
git lfs track "*.fbx"
git lfs track "*.obj"
git lfs track "*.blend"
git lfs track "*.unitypackage"
git lfs track "*.asset"

Add these to .gitattributes. Commit .gitattributes before adding binary files.

Common Workflows

Feature branch

git checkout -b feature/player-movement
# work on your feature...
git add -A && git commit -m "Add player movement"
git push -u origin feature/player-movement
# create PR on GitHub / GitLab

Revert a broken commit

git revert HEAD            # safe: creates a new commit
git reset --soft HEAD~1    # undo last commit, keep changes

Stash work in progress

git stash push -m "WIP: inventory UI"
git stash pop

Resolve merge conflict

git merge main
# resolve conflicts in your editor
git add .
git commit

Tag a release build

git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0

Large Binary Strategy Reference

StrategyMax file sizeCostBest for
Git LFS~2 GBFree tier variesMost game studios
Git AnnexUnlimitedSelf-hostedLarge studios with own infra
Perforce (assets only)UnlimitedPer-seatAAA studios
.gitignore + cloud syncN/AVariesSolo devs, small projects

Frequently asked questions

Should I use Git or Perforce for my game project?
For most indie and mid-sized studios, Git with LFS is the better choice. It is free, widely understood, and works well with GitHub, GitLab, and Bitbucket. Perforce is better for AAA studios with very large repositories (100+ GB) and teams that need file locking for binary assets. Many studios use a hybrid: Git for code, Perforce or cloud storage for art.
How do I set up Git LFS for a Unity project?
Install Git LFS once (git lfs install), then track binary types: git lfs track "*.psd" "*.png" "*.fbx" "*.wav" "*.uasset". Commit the .gitattributes file so the rules apply for everyone. Existing binaries already in history are not migrated; use git lfs migrate if you need them moved.
Why is my Unity .meta file causing merge conflicts?
Two people probably touched the same asset simultaneously, generating different GUIDs in .meta. Resolve by keeping one version (usually the one in main) and re-importing the asset locally. To prevent it, use Visual Studio Code merge tools or Unity Smart Merge for .unity and .prefab files.
How big can a Git repo with LFS get before it becomes painful?
LFS handles individual large files cheaply, but the LFS storage is paid above ~1-2 GB on GitHub. For repos consistently >50 GB total, consider Perforce or cloud asset stores (S3, Azure Blob) keyed from .gitattributes references. Practical pain starts around 20-30 GB on GitHub LFS.
Why is Library still in my repository after adding it to .gitignore?
Because .gitignore only prevents untracked files from being added; it has no effect on files Git already tracks. Run git rm -r --cached Library to stop tracking it while leaving the folder on disk, then commit. Everyone else gets the deletion on their next pull, and their local Library rebuilds automatically.
Should I commit .meta files in Unity?
Yes, always. A .meta file holds the asset's GUID, and every reference in your scenes and prefabs points at that GUID rather than at a file path. Ignoring .meta files means every teammate generates different GUIDs for the same asset, and references break in ways that look random. Set Editor Settings to Visible Meta Files and commit them alongside their assets.
Should ProjectSettings be committed?
Yes. ProjectSettings holds your input axes, physics layers, quality levels, and player settings, and the project behaves differently without it. UserSettings is the one to ignore: it holds per-developer editor layout and preferences that should not be shared.

Last updated: