[英]gitignore all files except the .json files in all subdirectories of a particular directory
my current directory tree looks like:我当前的目录树看起来像:
.
├── test1
│ ├── test.docx
│ ├── test.jpg
│ ├── test.json
│ ├── test2
│ │ ├── test.docx
│ │ ├── test.jpg
│ │ ├── test.json
│ │ └── test4
│ │ ├── test.docx
│ │ ├── test.jpg
│ │ └── test.json
│ └── test3
│ ├── test.docx
│ ├── test.jpg
│ └── test.json
└── test5
├── test.docx
├── test.jpg
├── test.json
├── test2
│ ├── test.docx
│ ├── test.jpg
│ ├── test.json
│ └── test4
│ ├── test.docx
│ ├── test.jpg
│ └── test.json
└── test3
├── test.docx
├── test.jpg
└── test.json
I want to ignore everything except .json
files which are under test1
directory.我想忽略除test1
目录下的.json
文件之外的所有内容。
my .gitignore
file looks like:我的.gitignore
文件如下所示:
/*
!/.gitignore
!/test1
/test1/**/*.json
my git status -sb
output is:我的git status -sb
output 是:
## No commits yet on master
?? .gitignore
So, it is not tracking the .json
files under test1
directory.因此,它没有跟踪test1
目录下的.json
文件。
What might be the solution here?这里的解决方案可能是什么?
Try only this line in.gitignore file仅尝试在 .gitignore 文件中的这一行
test1/.*.json test1/.*.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.