git Git忽略所有缩小的后缀文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25987084/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git ignoring all minified suffixed files
提问by cat-t
I currently have something like:
我目前有类似的东西:
javascripts/
plugin.js
plugin.min.js
stylesheets/
style.css
style.min.css
How would I get all .gitignore
to ignore all minified (.min
) files? Would something like **/*.min.*
work?
我如何让所有人.gitignore
忽略所有缩小的 ( .min
) 文件?想**/*.min.*
工作吗?
回答by zessx
You have several solutions, depending of what you really need.
您有多种解决方案,具体取决于您的真正需要。
Ignore all minified files in your project :
忽略项目中的所有缩小文件:
*.min.*
Ignore all minified files in a folder :
忽略文件夹中的所有缩小文件:
assets/*.min.*
Ignore only JS/CSS minified files in your project :
仅忽略项目中的 JS/CSS 缩小文件:
*.min.js
*.min.css
回答by Patel. D
I believe you have to git rm filename --cached
to remove the files from your git repo if you added it to .gitignore afterwards. (note: this will remove it from the repo, not from directory)
我相信git rm filename --cached
如果你之后将它添加到 .gitignore 中,你必须从你的 git repo 中删除这些文件。(注意:这会将它从 repo 中删除,而不是从目录中删除)
回答by James
just having this in the gitignore should work
只在 gitignore 中有这个应该可以工作
*.min.*