Reputation: 3181
I have the following situation.I have a folder called configs. Inside there I have some files which contain the word ".example.js".Now what I want to do for this directory is to ignore the files that do not contain ".example.js",
For example consider foo.example.js
and foo.js
.I want to ignore foo.js
The reason that I just don't add foo.js
in my .gitignore is that in that directory there might be more files that do not include .example.js
like
secrets.js
or settings.js
.Is there any way to do this?
Upvotes: 0
Views: 532
Reputation: 478
I'm assuming config
folder resides in the root folder of your repository.
Try adding the following two lines to your .gitignore
:
/config/*
!/config/*.example.js
Upvotes: 4