Search code examples
gitdirectorygitignore

How to exclude folders in range with gitignore


I have this folder called 90, but the name could change into 91, 92 ecc. How can i ignore all the possibile folders that will be created?

I tried this in the .gitignore

**[90-100]/

But it didn't seem to work. Any idea would be appreciated.


Solution

  • The matching is done characterwise. You want just *[0-9]/ to match any folder name ending with at least one digit, or you can get more explicit by specifying multiple patterns like *[^0-9][1-9][0-9]/ for folder name having an exactly two-digit trailing number.