gitignore目录中所有扩展名的文件 [英] gitignore all files of extension in directory

查看:674
本文介绍了gitignore目录中所有扩展名的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法忽略目录中所有类型的文件?

** 显然是没有意义的混帐,所以这是行不通的:

  / 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆