如何在一个目录及其子目录中仅忽略某种文件类型?
为了解释我的意思,想象以下设置:
- anotherdir/
- seeme1.iml
- foldertoignore/
- ignoreme1.iml
- seeme3.txt
- anotherignorefolder/
- ignoreme2.iml
- seeme4.txt
- seeme5.iml
我想要做的是告诉git(使用.gitignore文件)只在 foldtertoignore 目录下忽略*.iml文件。
我认为这将起作用:
foldertoignore/*.iml
但是这只找到了ignoreme1.iml而没有找到ignoreme2.iml
我知道如何告诉它忽略*.iml,但不包括特定目录。这与其相反。有什么想法吗?
**
'似乎不会递归地应用(正如在https://dev59.com/rXNA5IYBdhLWcg3wa9Gp#971523,https://dev59.com/1nNA5IYBdhLWcg3wWsiK#991873中已经看到的,并在这里详细解释:https://dev59.com/p3E85IYBdhLWcg3wMAfc#2902126)。 - VonC**
对OP有效,我会建议使用它。否则,采用knittl的答案。 - manojlds