Can you split a .gitignore file into multiple files?

For example, a directory of .gitignore.d fragments instead of a single large .gitignore file.

NB: I'm not talking about .gitignore files in subdirectories.

+4
source share
2 answers

That would be useful to me too. And I considered (lazy) ways to achieve a similar effect.

(It seems that the erroneous assumption that .d / structures are useful only for a certain physical size, but this is simply due to a decrease in complexity when several external systems want to manage a single resource without heavy overhead. Consider / etc / apt / sources. list - most people sources.list files are less than 5 lines, but everyone understands the benefits of having partner sources. list.d / structure.)

Returning to .gitignore - etckeeper solves this problem for itself within /etc/.gitignore using the old classic:

  # begin section managed by etckeeper (do not edit this section by hand) ... # end section managed by etckeeper 

This section can be changed with any update to etckeeper, natch.

Thus, one obvious option is to use a similar subsystem for this, identifying it accordingly. A bit messy, according to the code, perhaps than the git-merge-line set, but perhaps a more documented / more ordinary / more convenient approach to workflow.

+2
source

No, you probably can't. But you can create it, perhaps in your Makefile.

+1
source

Source: https://habr.com/ru/post/1443838/


All Articles