gitignore目录中所有扩展名的文件 [英] gitignore all files of extension in directory
问题描述
有没有办法忽略目录中所有类型的文件?
**
显然是没有意义的混帐,所以这是行不通的:
/ public / static / ** / *。js
这个想法是匹配任意嵌套的文件夹。
从来没有尝试过,但 git帮助忽略
表明如果你把一个 .gitignore
with *。js
在 / public / static
中,它会做你想做的。
注意:请务必在下面检查Joeys的答案:如果您要忽略特定子目录中的文件,那么本地.gitignore是正确的解决方案(本地化很好)。但是,如果您需要相同的模式来应用到您的整个回购,那么**解决方案会更好。
Is there a way to ignore all files of a type in a directory?
**
is apparently meaningless to git, so this doesn't work:
/public/static/**/*.js
The idea is to match arbitrary nested folders.
Never tried it, but git help ignore
suggests that if you put a .gitignore
with *.js
in /public/static
, it will do what you want.
Note: make sure to also check out Joeys' answer below: if you want to ignore files in a specific subdirectory, then a local .gitignore is the right solution (locality is good). However if you need the same pattern to apply to your whole repo, then the ** solution is better.
这篇关于gitignore目录中所有扩展名的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!