Question: How to exclude *.tsx
, migrations files, and
python tests files?
git grep 'tiger' -- '*.py' ':!*tests*' ':!*migrations*'
# same as
git grep 'tiger' -- '*.py' ':(exclude)*tests*' ':(exclude)*migrations*'
After the --
the patterns used are
<pathspec>
, see man gitglossary
.
rg 'tiger' --glob '!{**/tests/*,**/migrations/*}'
# if you are sure there are no files with name `tests` or `migations`, you
# can do
rg 'tiger' --glob '!{tests,migrations}'
rg 'tiger' -g '!tests' -g '!migrations'