'Can a gitignore file have a name?
For example, can you name a .gitignore file foo.gitignore?
Ultimately, the purpose for this being to have multiple .gitignore files for different sub-project types.
Solution 1:[1]
Short answer: no, not natively.
I suggested before a content-filter driver which, on checkout, would automatically modify a .gitignore with the content of other files (like a foo.gitignore).
However, that require a local setting to activate that driver
git config filter.gitignore.smudge 'script_to_modify_gitignore'
Meaning: when you clone the repository, that mechanism would not be immediately active, not without the manual git config step.
Solution 2:[2]
No, it can't. Well, more precisely, it can have a name, but that name is always .gitignore.
(Note that you can store entries in .git/info/exclude as well, but that is never a tracked file and does not get committed.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VonC |
| Solution 2 | torek |
