gitignore:忽略文件夹层次结构中除一个特定文件类型外的所有文件 [英] gitignore: Ignore all files in folder hierarchy except one specific filetype
问题描述
我想忽略下面的所有文件和文件夹,但可能位于文件夹层次结构中的某个特定文件类型:
$ b
示例
/ Test
/ Test / unknown / folder / structure / below
现在我想忽略 Test 文件夹下的所有文件,除了某个名为<$的css文件外c $ c> layout.css
,例如:
/Test/layout.css
/Test/fileto.ignore
/Test/another/folder/ig.nore
/Test/in/a/unknown/folder/layout.css
/ Test / in / a / unknown / folder / ignore.me
.gitignore应该忽略
/Test/fileto.ignore
/Test/another/folder/ig.nore
/ Test / in / a / unknown / folder / ignore .me
我的.gitignore文件不起作用:
Test /
!layout.css
<任何建议?
我w因为能够通过在 Test /
目录中添加 .gitignore
文件来获得您的示例,其中包含以下内容。
*
!* /
!.gitignore
!layout.css
I'd like to ignore all files below and in a folder except a specific filetype that could be somewhere in the folders hierarchy:
Example
/Test
/Test/unknown/folder/structure/below
Now I'd like to ignore all files in and below the Test
folder except a certain css file named layout.css
, e.g.:
/Test/layout.css
/Test/fileto.ignore
/Test/another/folder/ig.nore
/Test/in/a/unknown/folder/layout.css
/Test/in/a/unknown/folder/ignore.me
.gitignore should ignore
/Test/fileto.ignore
/Test/another/folder/ig.nore
/Test/in/a/unknown/folder/ignore.me
My .gitignore file does not work:
Test/
!layout.css
Any suggestions?
I was able to get your example to work by putting a .gitignore
file in the Test/
directory with the following contents.
*
!*/
!.gitignore
!layout.css
这篇关于gitignore:忽略文件夹层次结构中除一个特定文件类型外的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!