Ignore file for Git and Unity

After the initial bewilderment of starting up git for my personal projects (I’d previously used Subversion and Perforce), I’m finding it quite nice. For those of you thinking of going Git with Unity, here’s a working ignore file. It basically covers the files listed in Unity’s source controlĀ documentation, plus the Temp directory. Anything else in the project directory gets versioned.

Paste the following in a plain text file named .gitignore located in your project directory (the repo root):

*.apk

Thumbs.db

Temp/

Library/*

!Library/EditorBuildSettings.asset

!Library/InputManager.asset

!Library/ProjectSettings.asset

!Library/QualitySettings.asset

!Library/TagManager.asset

!Library/TimeManager.asset

!Library/AudioManager.asset

!Library/DynamicsManager.asset

!Library/NetworkManager.asset

If you want to add more files to ignore, the syntax is pretty simple:

*.Ext : Standard wildcard

File.Ext : Specific file

Dir/ : Entire directory

Dir/* : All files in directory (there's a difference! Thanks to James O'Hare for pointing that out)

!Dir/File : Negates ignore flag (you'll need to use the aforementioned [Dir/*] for this. [Dir/] will effectively override the ignore flag)