git ignore multiple matching files
I try to ignore file in a directory by relative path. E.g. I have several directories in working tree
lib/file.f and I want all occurrences of this file to be ignored. I tried
but this does not work.
3 Solutions collect form web for “git ignore multiple matching files”
.gitignore. This will cause git to ignore any file of the form
.gitignore is in the
To make git ignore
lib/file.f two directories down, you’d also have to add
.gitignore, and so on.
Vastly simpler of course, would be to place
.gitignore to block all files named
file.f, but your question seems to suggest there is at least one file by that name you wish not to ignore.
also you might want to remove the file from git cache, in order to check what you just ignored:
git rm --cached lib/file.f
this is if you already added the file to git index
If you want to specify all sub-folders under specific folder use
/**/. To ignore all
file.f files in a
/src/main/ folder and sub-folders use: