I need to ignore the following.
In paths like /a/b/c/d/e/f/g
, I need to ignore /d/e/f/g
. I also need to be able to ignore every place /d/e/f/g
appears beneath a
. I tried d/e/f/g
, but that did not work. Thoughts?
Interesting requirement. I'm curious what your use case actually is.
The way you should do something like this is a separate .gitignore
in the parent directory of each sub-tree you need to exclude (git reads all the .gitignore
files on its way down the tree).
If you really want a single .gitignore
file... Well, I haven't tried this, but going by the gitignore doc, it's mostly a typical shell glob, so what might work is something like:
a/*/d/e/f/g a/*/*/d/e/f/g a/*/*/*/d/e/f/g
... repeating with an ever-increasing number of asterisks out to the deepest you expect it to reasonably go.
I imagine there will be a performance penalty here, but I don't know how serious. Probably not noticeable for most repos on any system built in the last 5-10 years.
Try:
**/d/e/f/g
or:
a/**/d/f/g
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