Home > Enterprise >  Can a gitignore file have a name?
Can a gitignore file have a name?

Time:05-14

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.

CodePudding user response:

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.

CodePudding user response:

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.)

  • Related