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?
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
gitignore just ignores files that have not yet been added to the repository. If you have already git added certain files, their modifications will be tracked. Use git rm -r --cached on such files to delete them from your repository (but not from your file system).
To avoid having to ignore unwanted files manually, you can create a . gitignore file in the working directory of your project. Inside this file, you can specify simple patterns that Git will use to determine whether or not a file should be ignored.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With