I would like to know whether it is possible to have named .gitignore files in a repository, such as:
Composer.gitignore
Node.gitignore
Both of the above examples are shown available in GitHub's gitignore template repository (perhaps this might be a bit misleading).
I have tried adding Composer.gitignore to my repository and it seems like the file is not read (I'm using SourceTree).
EDIT:
Adding relevant information added by Boldewyn that does not directly answer the question:
The page's README says:
A Collection of
.gitignoretemplates and that's what it is: Only templates. If you want to use one, pick it, drop it in your repository and rename it to.gitignore.git recognizes only two places for listing ignored files:
.gitignorefiles in a folder/subfolder and the file.git/info/ignore. Seegit help gitignorefor in-depth information.
The only way you could make a file not name .gitignore as a .gitignore file is:
reference it directly
git config --global core.excludesfile ~/myfile.gitignore
generate it through a smudge script from a content filter driver.
That second option is a bit convoluted, but would process all versionned <file>.gitignore and generate the final .gitignore.
Other than those two options, the .gitignore man page doesn't allow any other naming convention.
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