You’re working on a project with a ton of files, and you need to find that needle in the haystack. No problem, you fallback on your old friend:
grep -Rn 'neeedle' .
The only problem is that your project directory also contains a bunch of build files that you don’t want to include in your recursive
grep search. For example,
.meteor/ under a MeteorJS project contains all of your code minified and bundled.
Assuming that you’re using
git to version your files (if you’re not, you should be) you can use
git grep 'TODO'
This will recursively search only the files that are tracked in your repository (respects
Note: You can also use
--exclude-dir with GNU Grep >=2.5.2 but who wants to type that out?