· 6 years ago · Feb 12, 2019, 11:24 AM
1# OS-level helper files (cache, folder preferences)
2Thumbs.db
3# path/to/anywhere/Thumbs.db
4.DS_Store
5# any/folder/.DS_Store
6
7# Logs
8*.log
9# anywhere/my.log, NOT my.logs, my.log.tmp
10
11# Compiled files
12*.class
13*.py[co]
14# same as: *.pyc OR *.pyo, NOT *.pyco
15
16migrate-201[5-7]*
17# anywhere/migrate-2015, migrate-20170101.db, NOT migrate-2018...
18
19*.py?
20# anywhere/*.py<any char>, *.pyc OR *.pyo OR *.pyd, NOT *.py
21
22# slash at the end means a folder
23build/
24# folder "build", NOT file "build"
25
26# Patterns above match anywhere in the project
27# build/
28# scripts/build/
29
30# PATH-AWARE MODE
31/build/
32# build, but NOT scripts/build
33
34# in slash mode match relative to .gitignore
35secret/key
36# secret/key, NOT docs/secret/key
37
38doc/*.html
39# doc/file.html, NOT somewhere/doc/file.html
40
41/*.txt
42# my.txt, NOT somewhere/my.txt
43
44# wildcard matches within a path segment
45var/www*/tmp
46# var/www/tmp
47# var/www-home/tmp
48# NOT var/www/info/tmp
49
50# ... or replaces a path segment
51users/*/private
52# users/john/private
53# users/alice/private
54# NOT
55# users/private
56# users/john/project/private
57# script/users/john/private
58
59# double wildcard ** replaces any number of path segments
60**/*.log
61# same as *.log
62
63**/app/cache
64# shop/app/cache
65# main/front/app/cache
66
67docs/**/*.html
68# docs/module/generated.html
69# docs/general/info/performance.html
70# NOT
71# subdir/docs/my.html
72
73# ** can only be used as **/...
74# or .../**/...
75# or .../**
76
77# .*
78!.gitattributes
79!.gitignore
80
81# DOESN'T WORK
82# install/ ignores directory, making its content unknown to git
83# so we can't "unignore" anything inside it
84/install/
85!install/packages.xml
86
87# INSTEAD
88# ignore not install/, but each item of its content
89# this way we can "unignore" it
90/install/*
91!install/packages.xml