In all subdirectories
Ignore Directory In All Subdirectories from .gitignore
Syntax
These syntaxes will ignore directory matches across ALL subdirectories.
dir_ignoreddir_ignored/**/dir_ignored/Example:
In the following example ALL files will be ignored, with either of the above syntax.
. ├── dir_ignored │ ├── f1.txt │ └── subdir-in-ignored │ └── f2.txt └── subdir-in-top └── dir_ignored └── f3.txt 4 directories, 3 filesClarification
Must match directory exactly
The syntax that we used here must match directory exactly.
For example if we add suffix to directory name it WILL not match:
Link to original . ├── dir_ignored │ └── gets-ignored.txt └── dir_ignored_2 └── i-am-not-ignored.txt 2 directories, 2 files
Only next to .gitignore
Ignore Directory Only Next to .gitignore
Syntax to ONLY ignore directory that is next to .gitignore
/dir_ignored//dir_ignoredExample with above syntax
- Anything below ./dir_ignored wil be ignored.
- ./subdir/dir_ignored/i-am-NOT-ignored.txt will NOT be ignored.
Link to original . ├── dir_ignored │ ├── f2-ignored.txt │ └── subdir │ └── f1-ignored.txt └── subdir └── dir_ignored └── i-am-NOT-ignored.txt 4 directories, 3 files