Search directories for a regex pattern while respecting your gitignore
GitHub RepoImpressions1.1k

Search directories for a regex pattern while respecting your gitignore

@githubprojectsPost Author

Project Description

View on GitHub

Ripgrep: The Grep That Respects Your Gitignore

Ever found yourself grepping through a project only to get a flood of results from node_modules, .git, or build artifacts? You start adding a bunch of --exclude-dir flags, and suddenly your simple search command looks like a fragile shell script. There's got to be a better way.

Enter ripgrep. It's a line-oriented search tool that, by default, respects your .gitignore rules and skips hidden files and binary files. It gives you the results you actually care about, without the noise. It's like grep decided to finally understand how modern development works.

What It Does

Ripgrep (rg) is a command-line search tool that recursively searches your current directory for a regex pattern. Its core mission is simple: be fast and smart about what it searches. Out of the box, it automatically ignores files and directories specified in your .gitignore, .ignore, .rgignore, and even your global gitignore. It also skips hidden files and directories, and binary files, unless you explicitly tell it not to.

It's a drop-in replacement for grep -r, but one that's tuned for searching code.

Why It's Cool

The magic of ripgrep is in its thoughtful defaults. You don't have to configure it to be useful; it's useful immediately. Just cd into a project and run rg "functionName". You'll search your source files, not the dependencies or the generated cruft.

But the cool factor doesn't stop there. It's incredibly fast, often beating other search tools in benchmarks, thanks to its efficient implementation in Rust. It also has great UX: it colors output by default, groups matches by file, and even shows the line numbers. It understands a huge range of regex patterns (via the Rust regex engine) and can search across a wide variety of text encodings.

For developers, the killer feature is truly its respect for version control. It knows what's in your repo and what isn't, so you're searching the code you wrote, not the thousands of files in your vendor or target directory.

How to Try It

Installation is straightforward. You can grab a pre-built binary for your platform from the GitHub Releases page.

If you're on macOS and use Homebrew, it's as simple as:

brew install ripgrep

For Ubuntu/Debian users (21.04 and later), you can use apt:

sudo apt install ripgrep

Once installed, open a terminal in any git-controlled project and give it a spin:

rg "TODO"
rg "def calculate"
rg --type js "console\.log"

Final Thoughts

Ripgrep has become an indispensable tool in my daily workflow. It turns a common, often frustrating task—searching my codebase—into a fast, clean, and predictable experience. It's one of those utilities that just works the way you expect, removing friction instead of adding it. If you live in the terminal and frequently need to find things in your code, it's absolutely worth adding to your toolkit. It might just replace your use of grep for good.

Check out the project, contribute, or just say thanks over at the ripgrep GitHub repository.


@githubprojects

Back to Projects
Project ID: e42b4595-7d21-4cc8-a437-6419701c0088Last updated: December 13, 2025 at 04:39 AM