How can I ignore a certain filetype only in one directory and its sub-directory?
To explain what I mean imaging the following setup
- anotherdir/
- seeme1.iml
- foldertoignore/
- ignoreme1.iml
- seeme3.txt
- anotherignorefolder/
- ignoreme2.iml
- seeme4.txt
- seeme5.iml
I want to be able to do is tell git (using .gitignore file) to ignore *.iml but only under the directory foldtertoignore.
I was thinking this would work
foldertoignore/*.iml
But that only found开发者_StackOverflow中文版 ignoreme1.iml not ignoreme2.iml
I know how to tell it to ignore *.iml except for a specific directory. This is the reverse of that. Any thoughts?
.gitignore
rules are applied recursively from the containing directory. Simply create the file foldertoignore/.gitignore
with *.iml
as contents.
>>foldertoignore/.gitignore echo '*.iml'
git add foldertoignore/.gitignore
git commit -m 'Ignore .iml files in foldertoignore and its subfolders'
You can try this:
/foldertoignore/**/*.iml
It may or may not work depending on fnmatch implementation in your OS I suppose. Alternative is:
*.iml
!/anotherdir/*.iml
!/*.iml
精彩评论