notes to self

Grep like an LLM · part 6 of 6

The cheatsheet

On this page

Every command from the series, gathered for the moment you need one. The modules teach them one at a time; this page is for the day one slips.

Make a map

You want to know Run
Where does this feature live? git grep -ci 'loyalty'
Which files mention it at all? git grep -li 'loyalty'

Find the door

You want to know Run
What renders this exact text? git grep -F '99 Flake (+ £0.50)'
Which files are named after it? git ls-files | grep -i menu
Enough context to skip the file git grep -n -C 3 'jingle'

Follow the data

You want to know Run
What is this thing, really? git grep -n 'model Flavour' -- '*.prisma'
The word, not every substring git grep -ciw 'van'
Who sets this value? git grep -n 'soldOutAt ='

Ask the history

You want to know Run
What changed in this area? git log --oneline -- services/stock/
When did this string appear, and why? git log -S 'meltAlert' --oneline

The flags

The same flags mean the same thing in grep, git grep and ripgrep.

Flag Meaning
-i ignore case
-l filenames only
-c count of matches per file
-w whole words only
-n line numbers
-F literal string, regex off
-C 3 three lines of context around each match
--oneline one commit per line, for git log
-S 'x' commits that add or remove x, for git log

If a command has slipped and the one-liner here isn't enough, its module is one click away in the series overview below.