# ignore all .out files
.out
# but do track a.out, even though you are ignoring .out files above
!a.out
# only ignore the TODO file in the current directory, not subdir/TODO
/TODO
# ignore all files in any directory named build
build/
# ignore doc/notes.txt, but not doc/server/notes.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory and any of it's subdirectories
doc/**/*.pdf
Nested
.gitignore
filesIn the simple case, a repository might have a single
.gitignore
file in its root directory, which applies recursively to the entire repository. However, it is also possible to have additional.gitignore
files in subdirectories. The rules in these nested.gitignore
files apply only to the files under the directory where they are located. The Linux kernel source repository has 206.gitignore
files.
Refs
- “Pro Git” by Scott Chacon and Ben Straub