Ultimate .Gitignore File for Unity Projects

Nov 12th 2019

When I start a new unity project always I start googling the best .gitignore file to add so git ignores visual studio stuff, operating system, temporary generated files, and so on.

Sometimes I find a good one and sometimes not. I decided to publish the best candidate I use for the moment.

The file goes like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# =============== #
# Unity generated #
# =============== #
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ibrary/
[Mm]emoryCaptures/
sysinfo.txt
*.stackdump
sysinfo.txt
# ============================ #
# Never ignore Asset meta data #
# ============================ #
!/[Aa]ssets/**/*.meta
# ============================ #
# Unity3D generated meta files #
# ============================ #
*.pidb.meta
*.pdb.meta
*.mdb.meta
# =============================================== #
# Visual Studio / MonoDevelop / Consulo generated #
# =============================================== #
[Ee]xported[Oo]bj/
.vs/
/*.userprefs
/*.csproj
/*.pidb
/*.suo
/*.sln*
/*.user
/*.unityproj
/*.booproj
.consulo/
*.tmp
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# =============== #
# Rider generated #
# =============== #
.idea
[Aa]ssets/Plugins/Editor/JetBrains*
# ============ #
# OS generated #
# ============ #
.DS_Store*
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
[Tt]humbs.db
# ====================== #
# Gradle cache directory #
# ====================== #
.gradle/
# ====== #
# Builds #
# ====== #
*.apk
# ========================== #
# Crashlytics generated file #
# ========================== #
crashlytics-build.properties