FahamLah

Commands

git grep

git grep [-n] [-i] <pattern> [<rev>]

Risk: Safe

What it does

Searches the files Git tracks for a word or pattern.

When to use it

To find where something is used in your project.

Example

$ git grep -n footer

Show every line with footer, with line numbers.

$ git grep TODO HEAD~2

Search the files as they were two commits ago.