17

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?

cat-t
  • 1,346
  • 1
  • 18
  • 34

3 Answers3

38

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
zessx
  • 68,042
  • 28
  • 135
  • 158
  • 2
    Any idea why this doesn't work? I added `*.min.*` but `git status` still returns bunch of .min.js files... – Azimuth Jun 27 '17 at 12:32
  • Experiencing the same thing. Using `*.min.*` in a top level .gitignore, yet still all `foo.min.bar` files are being included. – Adam Reis Feb 08 '18 at 20:01
  • if you have already checked them in, you have to delete them from the repository. – Hernan Sep 11 '19 at 18:25
5

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)

Patel. D
  • 51
  • 1
  • 1
3

just having this in the gitignore should work

*.min.*
James
  • 774
  • 6
  • 8