Reputation: 5656
I would like to ignore all files with extensions *.mtx
or *.otc
in a certain folder (data/
) and all files with extension *.pyc
in all subfolders. Will this .gitignore
should work?
/data/*.mtx
/data/*.otc
*.pyc
Is there a way to make it more compact? Apparently this doesn't work:
/data/(*.mtx|*.otc)
*.pyc
Upvotes: 3
Views: 1928
Reputation: 1329472
I'd rather not use local gitignore unless strictly necessary, because it seems to me tidier to have all "ignore" instructions in one place, but I'm open to suggestions here
You can keep only one .gitginore at the root folder of your repo.
**/data/*.mtx
**/data/*.otc
*.pyc
That would ignore mtx
or otc
files in data folders, even if data is not a top-level folder (because you are not using the anchor '/').
Check if this is working with:
git check-ignore -v path/to/a/file
Upvotes: 2