Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I gitignore files with a prefix?

I have file a.css and b.css in the same folder. My framework combines those files in a file called temp.a12cab4598347b07f0079d.css This file will be generated wherever there is a css file, so folder matching is no good. Can I ignore all these files using something like

temp.*.css

Thank you

like image 739
santiago arizti Avatar asked Aug 17 '15 15:08

santiago arizti


People also ask

Does .gitignore need to be in root?

gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple . gitignore files.

What files to ignore in Gitignore?

gitignore ignores just files that weren't tracked before (by git add ). Run git reset name_of_file to unstage the file and keep it. In case you want to also remove the given file from the repository (after pushing), use git rm --cached name_of_file .

How do I ignore a specific file type in git?

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.

How do I ignore a .class file in Gitignore?

The easiest and most common way to ignore files is to use a gitignore file. Simply create a file named . gitignore in the repository's root directory. Then, add names and patterns for any files and directories that should not be added to the repository.


1 Answers

It will work as expected.

Also, if you need to do this recursively in any subdirectory

**/temp.*.css
like image 127
Gabriele Petronella Avatar answered Oct 11 '22 11:10

Gabriele Petronella