Is there any way to do a case insensitive .gitignore using a regex for example? For example, inbox, Inbox, inBox, should all be ignored with a one liner in .gitignore. ? I am writing a script to generate a .gitignore file and hence do not know what kind of pattern would be available at the client side.
Asked
Active
Viewed 1.1k times
7
-
1Just a note: gitignore is case-sensitive. But on macOS, having the line `.DS_STORE` in gitignore ignores the file `.DS_Store` as well for me, i.e. is case-insensitive. However, that is likely because of the default macOS filesystem's (lack of) case-sensitivity support. – nishanthshanmugham Jul 08 '21 at 12:30
1 Answers
11
Based on this answer, gitignore file accepts glob patterns.
Following your example, you could do
[Ii]n[bB]ox

nishanthshanmugham
- 2,967
- 1
- 25
- 29

Flows
- 3,675
- 3
- 28
- 52
-
4That's a glob pattern and not a regex. You can't set a regex flag in `.gitignore` – CervEd Jul 01 '21 at 12:24
-
2