This is a short note to self about how to use
git instead of
grep to recursively find all occurrences of a certain text in all files within a root folder.
I have always used
grep to do this, but always have to lookup the syntax and it’s not as quick and intuitive as I’d like it to be.
git grep is a lot faster and much easier to use than
grep. If you use
git grep instead of
grep, you just have to type:
git grep 'the string to search for'
or to narrow it down to a certain file type:
git grep 'the string to search for' *.txt
This is a lot cleaner and MUCH faster than