diff --git a/README.md b/README.md index 04d7ce3..c3edb9f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1397 TILs and counting..._ +_1398 TILs and counting..._ --- @@ -1364,6 +1364,7 @@ _1397 TILs and counting..._ - [Hexdump A Compiled File](unix/hexdump-a-compiled-file.md) - [Ignore A Directory During ripgrep Search](unix/ignore-a-directory-during-ripgrep-search.md) - [Ignore The Alias When Running A Command](unix/ignore-the-alias-when-running-a-command.md) +- [Include Ignore Files In Ripgrep Search](unix/include-ignore-files-in-ripgrep-search.md) - [Interactively Browse Available Node Versions](unix/interactively-browse-availabile-node-versions.md) - [Interactively Switch asdf Package Versions](unix/interactively-switch-asdf-package-versions.md) - [Jump To The Ends Of Your Shell History](unix/jump-to-the-ends-of-your-shell-history.md) diff --git a/unix/include-ignore-files-in-ripgrep-search.md b/unix/include-ignore-files-in-ripgrep-search.md new file mode 100644 index 0000000..9325876 --- /dev/null +++ b/unix/include-ignore-files-in-ripgrep-search.md @@ -0,0 +1,31 @@ +# Include Ignore Files In Ripgrep Search + +By default, [ripgrep (`rg`)](https://github.com/BurntSushi/ripgrep) will look +for and respect _ignore_ files like `.gitignore`. Any file and directory marked +by those ignore files will no be included in an `rg` search. + +This is usually what you want. Sometimes, however, it can be useful to get +results from this ignored files as well. + +In order to ignore your ignore files, pass the `--no-ignore` flag to `rg`: + +```bash +$ rg --no-ignore ENV_VAR_KEY +``` + +Something to keep in mind is that `rg` also ignores _hidden_ files and +directories (those things that are prefixed with a `.`, such as `.env` or +`.config/`). If some of your ignored files are also _hidden_ files, then they +still won't show up in search. You'll need the `--hidden` flag as well. + +```bash +$ rg --no-ignore --hidden ENV_VAR_KEY +``` + +A shorthand equivalent for that is `-uu`: + +```bash +$ rg -uu ENV_VAR_KEY +``` + +See `man rg` for more details.