TIL: git grep – replace code

I’ve recently worked on this PR to make the codebase of the repository more consistent by ensuring all “platform checkout” renamed to “woopay”.

First, I tried to use this search:

grep --only-matching --ignore-case --extended-regexp --recursive --no-filename  "platform(.?)checkout" . | sort | uniq

However, it’s painful to exclude the .gitignore files and folders. And I recently learned to use git grep to achieve basically the same thing:

# -h => --no-filename
$ git grep --only-matching --ignore-case --extended-regexp -h 'platform(.?)checkout' | sort | uniq

Leave a comment