Skip to content

Exclude Specific Directories with gitignore

Create .gitignore

Create a file named .gitignore in the same location as .git.

Specify Directories to Ignore

/site/

Example syntax

# Comment. This is ignored
*.a       # Ignore .a files
!lib.a    # But still track lib.a even though it's a .a file
/TODO     # Ignore only the TODO file in the root directory; do not ignore TODO files in subdirectories
build/    # Ignore every file in the build/ directory
doc/*.txt # Ignore doc/notes.txt but not doc/server/arch.txt