# 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/**/*.pdfNested
.gitignorefilesIn the simple case, a repository might have a single
.gitignorefile in its root directory, which applies recursively to the entire repository. However, it is also possible to have additional.gitignorefiles in subdirectories. The rules in these nested.gitignorefiles apply only to the files under the directory where they are located. The Linux kernel source repository has 206.gitignorefiles.
Refs
- “Pro Git” by Scott Chacon and Ben Straub