rg --glob '*.js' 'fetch\(' .Use glob filters when file types alone are too broad or when you want path-specific targeting.
Control what ripgrep searches with globs, type filters, hidden files, and ignore behavior.
Include or exclude files and directories with shell-style globs.
rg --glob '*.js' 'fetch\(' .Use glob filters when file types alone are too broad or when you want path-specific targeting.
rg --glob '!*.min.js' 'sourceMappingURL' web/Excluding generated assets reduces noise and speeds up scans.
rg --glob '!dist/**' 'TODO' .This is helpful in monorepos that contain both source and build outputs.
rg --glob '*.ts' --glob '!*.d.ts' 'RequestInit' src/Multiple globs give precise control without editing ignore files.
rg --debug --glob '!vendor/**' 'openssl' .`--debug` is the fastest way to understand why an expected file did not appear.
Use built-in or custom file type definitions to search the right files quickly.
rg -t rust 'Result<' .Type filters are easier to read and reuse than complex globs.
rg -T md 'TODO' .This is useful when docs generate too much noise during code-focused searches.
rg --type-add 'proto:*.{proto,protodevel}' -t proto 'service ' .Custom types are ideal for proprietary extensions or mixed conventions.
rg --type-add 'web:*.{html,css,js,ts,tsx}' -t web 'aria-' .The custom definition only applies to this invocation unless you put it in config.
rg --type-listThis is useful before deciding whether to use `-t`, `--glob`, or a custom type.