Can we have multiple .gitattributes files in different repo subfolders?

1.7k Views Asked by At

Is there any way to have multiple .gitattributes files, one in each subfolder, so that files (in this case for more modular management of LFS)?

Or is .gitattributes different from .gitignore and only supports a single file at repo root?

Thanks

1

There are 1 best solutions below

0
On

https://git-scm.com/docs/gitattributes :

When deciding what attributes are assigned to a path, Git consults $GIT_DIR/info/attributes file (which has the highest precedence), .gitattributes file in the same directory as the path in question, and its parent directories up to the toplevel of the work tree (the further the directory that contains .gitattributes is from the path in question, the lower its precedence). Finally global and system-wide files are considered (they have the lowest precedence).

I.e., you can have as many .gitattributes files as you wish scattered all over the working tree. The same as for .gitignore.