Search for a string in multiple local repositories quickly

Using ripgrep

You have multiple repositories in a single folder and you want to search for a text in them. Maybe you updated a package.json version number and you want to see what other repository depends on that package so you can make then pull down your changes.

One of the ways is to open the parent folder in an IDE and perform a global search. This will work, but there are chances it will be slow. Fortunately, there is a faster way to get this done using the ripgrep command.

Here is an example:

$ rg app.component

This will look for all string values that match app.component within the current folder (if we haven't specified a file name).

The result looks like this:

image.png

Let's run something simpler:

$ rg component

All matches for text component show up:

image.png

If you just want file names, use:

$ rg component -l

Here is the result:

image.png

The best part of all this is that ripgrep honors your .gitignore file!

To learn more about this command, check out their GitHub: github.com/BurntSushi/ripgrep