Is it possible to have a .gitignore file in a subfolder, so that i may be better able to control what i need to be ignored and not affect a larger, "base" gitignore?
For example, there is the root .gitignore, but instead of lets say writing /path/to/folder in that file, in my folder to have another .gitignore that will only apply for that folder and it's children?
Answer is: Yes, it is possible to have a .gitignore file in a subfolder.
Documentation:
When deciding whether to ignore a path, Git normally checks
gitignorepatterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):
Patterns read from the command line for those commands that support them.
Patterns read from a
.gitignorefile in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the.gitignorefile. A project normally includes such.gitignorefiles in its repository, containing patterns for files generated as part of the project build.[...]
Thanks alfunx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With