Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ignore file extensions in git regardless of case?

Tags:

git

gitignore

I want to tell git to ignore e.g. jpg files regardless of how the extension is written.

e.g.

*.jpg

should ignore

.jpg, .JPG., .Jpg

etc.

Is that possible without telling git to ignore case altogether?

like image 496
Joseph Tura Avatar asked Jun 20 '12 09:06

Joseph Tura


People also ask

How do I ignore a file extension 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.

Are Gitignore files case-sensitive?

Just a note: gitignore is case-sensitive.

How do I ignore files while pushing to Git repository?

Excluding local files without creating a .Use your favorite text editor to open the file called . git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.

How do I ignore a file without adding to Gitignore?

To ignore untracked files, you have a file in your git folder called . git/info/exclude . This file is your own gitignore inside your local git folder, which means is not going to be committed or shared with anyone else. You can basically edit this file and stop tracking any (untracked) file.


1 Answers

Git ignore understands glob pattern, so you can use this

*.[jJ][pP][gG] 
like image 114
CharlesB Avatar answered Sep 21 '22 06:09

CharlesB