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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:25:19  来源:igfitidea点击:

Git ignoring all minified suffixed files

gitgitignore

提问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 .gitignoreto 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 --cachedto 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.*