Game Dev Cheat Sheet

Git for Game Development

.gitignore templates, Git LFS setup, workflows, and large binary strategies for game development teams.

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 to keep your repository clean, 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

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.

Last updated: