.gitignore file
File that determines what type of files should not be under GIT source control.
You can have multiple .gitignore files in your tree. The rules will apply to all child folders from where .gitignore resides. And .gitignore rules are add on from .gitignore files that are higher up the folder hierarchy.
Example ignore syntax file extension
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Ignore directory in all subdirectories that match
node_modules
Further notes
Ignore Directory
From Ignore Directory
Go to text →
In all subdirectories
From Ignore Directory In All Subdirectories from .gitignore
Go to text →
Syntax
These syntaxes will ignore directory matches across ALL subdirectories.
dir_ignored
dir_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 files
Clarification
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:
.
├── dir_ignored
│ └── gets-ignored.txt
└── dir_ignored_2
└── i-am-not-ignored.txt
2 directories, 2 files
Only next to .gitignore
From Ignore Directory Only Next to .gitignore
Go to text →
Syntax to ONLY ignore directory that is next to .gitignore
/dir_ignored/
/dir_ignored
Example with above syntax
- Anything below ./dir_ignored wil be ignored.
- ./subdir/dir_ignored/i-am-NOT-ignored.txt will NOT be ignored.
.
├── dir_ignored
│ ├── f2-ignored.txt
│ └── subdir
│ └── f1-ignored.txt
└── subdir
└── dir_ignored
└── i-am-NOT-ignored.txt
4 directories, 3 files
Children