Code and repositories / Read code
Search code and commits
You want to find where a function is used, or the commit that changed the login page. Search finds a text in the code of a repository, or in its commit messages, on TanStack Source. You do not need a clone.
6 min read
1. Open the search of a repository
Sign in, and open the repository. On the Code tab, type your text in Search this repository above the file list, and press Enter. The search page of the repository opens, on its Code tab.

2. Write the query
- Words find a text, in any case.
page the resultsfinds the lines that have that text. Put a phrase in double quotes to keep a word that looks like a qualifier as text:"repo:x". - A regular expression goes between slashes, in RE2's syntax:
/export (function|const) use[A-Z]/. Addiafter it to match in any case:/todo/i. RE2 has no lookarounds, such as(?=...), and no back-references, such as\1. A search with one is refused, and the answer says why. - Qualifiers narrow the files. A file must pass each kind of qualifier that you give, and one value of each kind.
| Qualifier | What it keeps | Example |
|---|---|---|
path: | A folder or a file, from the root of the repository. With *, a glob: * stays in one folder name, and ** matches any folders. | path:src/server, path:packages/*/src |
filename: | Files with this name, in any folder and in any case. * matches any text. | filename:package.json |
extension: | Files with this extension, in any case. | extension:tsx |
language: | Files of this language, by their extensions and names. | language:typescript, language:dockerfile |
3. Read the results
Each file shows its path and its matched lines, with each match marked. Click the path to open the file, or a line number to open the file at that line. Both links show the file at the commit that the search read, so the lines stay where the search found them.

The page shows 20 files at a time. Click Next for more.
4. Search the commits
Click Commits. The words of the query are found in the whole commit message, in any case. A /regular expression/ in RE2's syntax works too. These qualifiers narrow the commits:
| Qualifier | What it keeps | Example |
|---|---|---|
author: | Commits whose author has this text in the name or the email | author:ada |
author-name:, author-email: | Only the name, or only the email | author-email:@acme.com |
committer:, committer-name:, committer-email: | The same for the committer | committer:bot |
author-date:, committer-date: | A range of days, in UTC | author-date:>=2026-01-01, author-date:2026-01-01..2026-01-31 |
merge: | Only merge commits (true), or no merge commits (false) | merge:false |
hash:, parent: | A commit, or the children of a commit, by the start of its id | hash:1a2b3c4 |

5. Search the history of a branch or a file
Open History on a file, or the commits of a branch. Above the list, type a text of the message, the name or the email of the author, or both, and click Search. The list keeps only the commits that match. Click Clear to see the whole history again.

Search from the command line and from agents
src, the REST API and the MCP server search too. Name the repository, or an owner:
src search code "useState(" --repo acme/app --extension tsx
src search code "TODO: remove" --owner acme
src search commits login --author ada --repo acme/app
- REST:
GET /api/v1/search/code?q=<query>andGET /api/v1/search/commits?q=<query>. The answers have the shape of GitHub's search API:total_count,incomplete_resultsanditems. - MCP: the tools
search_codeandsearch_commits. - In a query of
src, REST or MCP,repo:owner/namenames a repository, andowner:the 20 most recently pushed repositories of a person or an organization that you can read. The answer lists the repositories that it read.
What works
- Search reads the code and the history at the tip of the default branch. REST and MCP can also read another branch, a tag or a commit of one repository (
ref). - TanStack Source has no index of all of its code. A search reads one repository, or the 20 most recently pushed repositories of one owner. A search that names neither is refused.
- A search finds only what you can read. The files of hidden workflows are in the vault, never in git, so a search never finds them.
- You need to be signed in, or to use a token. A scoped token cannot search, because a search can read several repositories.
- Each person can search 30 times a minute, because each search uses the git servers that all repositories share.
- Code search keeps up to 1,000 matched lines of each repository, and shows the first 50 lines of each file. Commit search reads the newest 10,000 commits of each history. The search box of a History page shows the first 100 commits that match. The git servers stop a search of one repository after 30 seconds. When a limit cut a search, the page says so.
- The git servers run words and most regular expressions. A regular expression with a part that they read in another way, such as
\d,\w,\s,\b,(?:...),(?i)or{2}, is matched by TanStack Source itself. For one search, it reads at most 2,000 files and 16 MiB of text in all the repositories together, and less for a long expression. When it stops there, the search says so in its notes, and the answer is incomplete. Narrow the search withpath:,extension:orrepo:. - TanStack Source matches regular expressions with RE2, which never backtracks, within a budget of work for each search. So no expression can make a search run long.
- When the git servers of a repository do not have a search feature yet (
filename:,extension:,language:, apath:with*, or commit search), the search says that it is not available yet. It never shows results that it did not filter.