Home > Enterprise >  Adding a pattern from a list in .gitignore
Adding a pattern from a list in .gitignore

Time:07-22

I need to ignore these three files:

boot.dev.tpl
boot.tst.tpl
boot.prd.tpl

Is there a way to add that to .gitignore in one line, something like:

boot.[dev|tst|prd].tpl # This doesn't work

CodePudding user response:

According to the .gitignore documentation, there is no facility for matching multiple multi-character sequences in a pattern.

The best solution for your situation is to list each file on its own line.

CodePudding user response:

You can also do this in a single line with /boot.*.tpl, assuming your files are at the toplevel of your git repository. But if they're nested in subdirectories you could do **/boot.*.tpl.

  • Related