Repositories

Search code

Search the files of one branch or tag in a repository. Open the Search tab in the repository header, or /<owner>/<repo>/search.

Search in the browser

Type a pattern; results update as you type. The ref switcher picks the branch or tag (the default branch unless you change it). Two toggles sit beside the box:

  • Aa: ignore letter case.
  • .*: treat the pattern as a JavaScript regular expression.

Results are grouped by file, with three lines of context around each match. Select the file name to open the file, or a line number to jump to that line. The address keeps your query and ref, so you can share the results.

Search from the CLI

sh
1cafe repo code search TODO --repo owner/repo --path src

--path limits the search to a file or directory (--path src includes src/main.ts but not src-other/main.ts). --regex and --ignore-case match the browser toggles, and --ref picks the branch or tag.

Limits

  • Only the files of the selected ref are searched, not history, commit messages, issues or pull requests.
  • At most 100 matches are returned; the page says Results truncated when there are more. Narrow the pattern or the path.
  • Regular-expression searches stop after 5,000 tree entries, 32 MiB of content or 4 seconds. Binary files and files over 1 MiB are skipped.
  • Context lines are shown for the first 50 matching files.
Read as MarkdownGitCafe documentation
Documentation