Stefan Steiger
Stefan Steiger

Reputation: 82166

.gitignore a file extension, but not a directory name

I have the following entry in .gitignore.

*.meta

Now this would be fine if only files would end in .meta.
Unfortunately, I have a directory /ProtoBuf.Meta/.
And now the entire content of ProtoBuf.Meta is ignored...

Is there a way to tell git that this gitignore directive is only for files, not directories ?

Upvotes: 1

Views: 64

Answers (1)

Saurav Sahu
Saurav Sahu

Reputation: 13924

Try this one

*.meta[!/]

or

!.meta/*

"!" negates the pattern

Upvotes: 4

Related Questions