Guides

Search Codebase Quickly: 4 Practical Moves

17 November 2026 · 7 min read · by Ayoush Chourasia

Say a client asks you mid-call when a behaviour changed and why, and you have seconds to find out. You do not need a new platform for that moment. You need a few fast moves you can run without thinking. This post shows you how to search codebase quickly with tools you already have: ripgrep for finding code, git history search for finding when it changed, blame for reading line history, and pull request search for the reason behind it.

These moves also fit a wider prep habit. Pair them with a short routine to prepare for a client call and you will walk in with the trails fresh instead of hunting live.

Start from the question shape

Before you type, sort the question into one of three shapes. Each shape has a fastest first move, and picking the right one saves you the most time.

Where is it? The client names a behaviour and you need the code. Start with text search across the repo. Your goal is one file and one function, not a full tour.

When did it change? The client says it worked differently before, or asks which release brought the change. Start with history search on the code you found. Your goal is the commit and its date.

Why is it like this? The client asks for the reason behind the current behaviour. Start from the commit, then read the pull request or ticket it links to. Your goal is the decision sentence you can quote.

Most live questions are the third shape wearing the first shape's clothes. "Where is the rounding done" often means "why does the rounding look odd". So find the code fast, then keep going to the reason.

1. Find the code with ripgrep

Ripgrep (rg) is a fast text search tool for your terminal. If plain grep feels slow on a big repo, ripgrep will feel instant, and it skips ignored files by default so you see less noise. Search for the user-facing word first, not the code word, because you are matching what the client said.

rg -i "prorat" --type py
rg -i "refund window" docs specs

The -i flag ignores case. The --type py flag limits results to Python files. The second command searches only the docs and specs folders, which helps when the behaviour is described in writing before it appears in code.

When results are wide, narrow them in this order. First add a folder. Then add a file type. Say rg -i "round" returns fifty files. Try rg -i "round" billing to stay in the billing folder, then limit by file type. Each step cuts noise without a new tool.

Two flags earn their place on calls. rg -l lists only file names, which is what you want when you first scope the area. rg -C 2 shows two lines of context around each match, so you open the right file first.

If you want the full flag list later, the official ripgrep guide is the stable reference.

2. Find when it changed with git history search

Once you have the file, find when the lines changed. Git can search history by content, which answers "when did this appear" directly. The two commands you need are git log -S and git log -G.

git log --oneline -S "prorate" -- billing/
git log --oneline -G "round.*day" -- billing/prorate.py

The -S flag finds commits where the count of matching lines changed — commits that added or removed the text. The -G flag finds commits where the change matches a pattern, which catches edits to a line that already held the word. Use -S for "when did this word arrive" and -G for "when did this line get edited". Both print one line per commit, newest first.

Read the newest match first, then check whether it is the real change or a later tidy-up such as a rename. Open the diff to tell them apart:

git show a1b2c3 --stat
git show a1b2c3 -- billing/prorate.py

The --stat view shows which files the commit touched. The second command shows the diff for your file only. If the message names a ticket, such as "see PROJ-412", note it now — that ticket is your bridge to the "why".

For the full flag list, see the official git log documentation.

3. Read the line history with blame

History search finds the commit. Blame shows you which commit owns each line right now, so you can start from the exact lines the client asked about. Run it on the file and read the lines in question:

git blame -L 40,70 -- billing/prorate.py

The -L 40,70 flag limits output to lines 40 to 70, which keeps the view small on a call. Each line shows the short commit hash, the author date and the code. Find the line the client means, note its hash, then read that commit:

git show a1b2c3 --format=fuller --no-patch

This shows the message, the date and the author without the diff, which is often enough to answer "when and by which change". If the message is thin, the ticket link inside it matters more than the message itself. Follow it.

Blame has one trap: it shows the last commit per line, which may be a later clean-up. If the blamed commit is "fix lint warnings", the real logic change sits one step earlier. Run git blame on the parent commit to see who owned the line before the tidy-up.

4. Search pull requests and tickets for the why

Code tells you what runs. Commits tell you when it changed. The reason lives in the pull request or ticket. Search those next, using the ticket ID from the commit message when you have it, or the feature words when you do not.

Start with the ID, because it is exact. Paste PROJ-412 into your ticket search or your host's pull request search and open the linked thread. Read in this order: the title, the linked pull request description, then the decision or closing comment. Skip the middle debate on a live call — you need the outcome sentence, not the play-by-play.

Without an ID, search by the words the team would have used, such as "prorat round". When you find a candidate, confirm it touched your file before you quote it. The "files changed" tab should show the same path you found in step one.

If you answer technical questions on sales calls, practise this step most. Quote the decision line with its link, and say plainly when the thread leaves the question open instead of filling the gap from memory.

A cheat sheet you can copy

Save this block where you can see it during calls — a sticky note, a snippet, or the top of your runbook. It lists the moves in the order you run them.

Where is it?
  rg -i "client-word" .
  rg -i "client-word" <folder> --type py
  rg -l "word" .            (file names only)
  rg -C 2 "word" <file>     (match plus context)

When did it change?
  git log --oneline -S "word" -- <path>
  git log --oneline -G "pattern" -- <file>
  git show <hash> --stat

Who owns this line now?
  git blame -L <start>,<end> -- <file>
  git show <hash> --format=fuller --no-patch

Why is it like this?
  Open ticket ID from the commit message.
  Or search tickets/PRs for "<module> <behaviour>".
  Read title, then decision/closing comment.
  Confirm "files changed" shows your file.

Run the block top to bottom and stop as soon as you can answer with a source. Most questions resolve in two or three commands plus one ticket read.

Putting it together on a call

Say a client asks "why do part-month invoices round down — did that change recently". You now have a fixed drill. First, find the code with rg -i "round" billing. Second, run git log --oneline -S "round" -- billing/ to see the latest commit that touched those lines. Third, run git blame on the lines to confirm the owning commit. Fourth, open the ticket ID from the message and read the decision.

Talk while you search so the silence stays short: "I am pulling up the change history on the rounding lines now." Then read the answer with its source. You answered when and why, and every part points at something you can share after the call.

If the trail runs cold — no ticket ID, thin message, no linked thread — say so honestly and turn it into an action point with an owner and a date. After the call, write the missing decision line into the ticket so the next search lands.

For repeated questions about the same client, a lasting map helps. A codebase knowledge graph stores these same trails — code to commit to ticket to doc — so you can walk them without re-running the commands each time.

Where HintGoblin fits

If you want these trails ready before the client asks, HintGoblin builds a graph per meeting from the code and documents you add, then cites the source behind each answer. See the pricing for the current plans.

Frequently asked questions

What is the fastest way to search a codebase?

Use ripgrep to find the code by text, then git log search and blame to find when and why it changed.

How do you find when a line of code changed?

Run git blame on the file to see the last commit per line, then read that commit message and its linked ticket.

How do you find why code behaves a certain way?

Trace from the code to the commit to the pull request or ticket, where the discussion and decision are recorded.

What if the answer is not in the code?

Search pull requests, tickets and docs for the feature name, then check meeting minutes for the decision behind it.

HintGoblin

Never say “let me get back to you” again.

Knowledge graphs for every meeting, cited answers during the call, minutes and action points after. Mac app + web dashboard.

See plans →