Sean
Sean

Reputation: 3385

Adding a pattern to gitignore file doesn't catch subdirectories

I want to ignore specific files that start with cached. In my .gitignore file I have the line cached* but when I do git status I get the following:

datasets/task1/thing1/cached_somethingsomething1
datasets/task2/thing2/cached_somethingsomething2
datasets/task3/thing3/cached_somethingsomething3
.
.
.

I've tried ** as well, but it's the same result.

Is there a way to recursively ignore files, or do I have to specify ignore patterns for each subdirectory?

Upvotes: 0

Views: 27

Answers (1)

Mike Slinn
Mike Slinn

Reputation: 8403

I believe this should work:

**/cached*

Maybe you might prefer this:

datasets/task?/thing?/cached*

Or this:

datasets/task*/thing*/cached*

Upvotes: 1

Related Questions