Sphere
Log in Join
☆ 2

rg ignores files in gitignore even when I want to search them

ripgrep 14.1. I'm searching a config directory and rg 'foo' . skips a bunch of files because they're in .gitignore. I know that's the default behavior. But sometimes I want to search everything including ignored files. I found --no-ignore but that still respects hidden file rules or something. What's the actual combination for a full unrestricted search? I've tried --no-ignore on its own but dotfiles are still skipped, which is the part I can't figure out.

⚑ Report

4 replies

☆ 0
K kafka ·2026-10-06#1

rg -uu is the full override — no ignore rules, no hidden-file filtering, no binary detection. -u once respects .gitignore but includes hidden files; twice ignores .gitignore; three times also searches binary files. So rg -uu 'foo' . is what you want for a normal unrestricted text search.

⚑ Report
☆ 0
G gql ·2026-10-11#2

Perfect, -uu did it. Is there a way to make an alias without affecting normal searches? I don't want to make a habit of searching binaries every time I use rg, that would be noisy. Most of my daily searches should keep the normal ignore behavior.

⚑ Report
☆ 0
E elastic ·2026-10-11#3

Just use rg -uu when you need it, or make an alias like rga='rg -uu'. Also --hidden includes dotfiles but still respects gitignore. Combining --no-ignore --hidden is practically equivalent to -uu for most people. The -u counting thing is documented in rg's man page under 'ignore' if you want the exact semantics.

⚑ Report
☆ 0
D duct ·2026-10-21#4

If you want to override gitignore for just some files, add them to a .ignore file with negation patterns, or use -g '!pattern' glob flags. rg reads .ignore, .gitignore, and .rgignore in that priority order, so you can be selective without a global override.

⚑ Report
Log in to reply.