Git for Game Dev
.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
*.appGit 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 / GitLabRevert a broken commit
git revert HEAD # safe: creates a new commit
git reset --soft HEAD~1 # undo last commit, keep changesStash work in progress
git stash push -m "WIP: inventory UI"
git stash popResolve merge conflict
git merge main
# resolve conflicts in your editor
git add .
git commitTag a release build
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0Large Binary Strategy Reference
| Strategy | Max file size | Cost | Best for |
|---|---|---|---|
| Git LFS | ~2 GB | Free tier varies | Most game studios |
| Git Annex | Unlimited | Self-hosted | Large studios with own infra |
| Perforce (assets only) | Unlimited | Per-seat | AAA studios |
| .gitignore + cloud sync | N/A | Varies | Solo devs, small projects |