Ignore Files In Gitignore Using Globbing Patterns

abstract

Pavol Kutaj
1 min readJul 16, 2021

The concern is documenting how to ignore files in a git project with a .gitignore file using so called globbing pattens (aka standard wildcards).

1. globbing patterns

Sixth Edition Unix, also called Version 6 Unix or just V6, was the first version of the Unix operating system to see wide release outside Bell Labs. It was released in May 1975 and, like its direct predecessor, targeted the DEC PDP-11 family of minicomputers. It was superseded by Version 7 Unix in 1978/1979, although V6 systems remained in regular operation until at least 1985.

— from Version 6 Unix — Wikipedia

  • powershell has globbing patterns implemented as well without any addition; DOS has some differences (see the wikipedia page)

2. special characters

  1. * for any char
  2. ? for single char
  3. []for range
  4. ! for negation
  5. \ for escape
  6. / for directory
  7. # for comment

3. my scenario

  • in one particular example, I need to filter all docs that contain either -prod1 string or alert string
  • also nothing in /docs folder
_site
.sass-cache
.jekyll-cache
.jekyll-metadata
vendor
gemfile.lock
*-prod1*
*alert*
/docs

4. sources

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com