Git ignoring all minified suffixed files

2020-04-02 07:03发布

问题:

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?

回答1:

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 :

*.min.js
*.min.css


回答2:

just having this in the gitignore should work

*.min.*


回答3:

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 gitignore