Skip to content

Filtering ​

github-code-search provides four result filtering options so you can exclude noise from what appears in the TUI or output.

--exclude-repositories ​

Excludes entire repositories from the results. The org prefix is optional.

bash
# Short form (recommended)
github-code-search "useFeatureFlag" --org fulll \
  --exclude-repositories legacy-app,archived-app

# Long form (also accepted)
github-code-search "useFeatureFlag" --org fulll \
  --exclude-repositories fulll/legacy-app,fulll/archived-app

Pass a comma-separated list. There is no limit on the number of repos you can exclude.

TIP

The short form (without the org prefix) is recommended — it is easier to read and works regardless of organisation name.

--exclude-extracts ​

Excludes individual code extracts. The format is repoName:path/to/file:matchIndex.

bash
# Exclude the first extract (index 0) of src/flags.ts in service-b
github-code-search "useFeatureFlag" --org fulll \
  --exclude-extracts service-b:src/flags.ts:0

# Exclude multiple extracts
github-code-search "useFeatureFlag" --org fulll \
  --exclude-extracts service-b:src/flags.ts:0,service-a:tests/unit/featureFlags.test.ts:1

# Long form (also accepted)
github-code-search "useFeatureFlag" --org fulll \
  --exclude-extracts fulll/service-b:src/flags.ts:0

The index is zero-based and corresponds to the position of the file in the GitHub API result list for that repository — not the position of the match within the file itself. Each (repo, file) pair is one extract with a unique index.

WARNING

An extract's index is relative to the GitHub API response for that repo. It may change if GitHub re-indexes the repository between calls. For greater stability, prefer --exclude-repositories when the entire repository should be excluded.

How to find the index ​

In the TUI, the extract rows are listed in API order: the first file shown for a repo has index 0, the second has index 1, and so on. In non-interactive mode, extracts are printed in the same order.

The replay command printed at the end of an interactive session automatically includes the correct --exclude-extracts values for any extracts you deselected — you don't need to figure out indices manually.

--include-archived ​

By default, archived repositories are excluded from results. Pass --include-archived to include them:

bash
github-code-search "useFeatureFlag" --org fulll --include-archived

INFO

Archived repos are silently filtered out in the aggregation step before the TUI is shown. This flag overrides that behaviour.

--exclude-template-repositories ​

By default, template repositories are included in results. Pass --exclude-template-repositories to filter them out:

bash
github-code-search "useFeatureFlag" --org fulll --exclude-template-repositories

INFO

Template repositories (marked as templates on GitHub) are filtered out in the aggregation step — both in interactive and non-interactive mode. Useful when your organisation uses template repos for boilerplate that should not appear in search results.

Combining filters ​

All four flags can be combined freely:

bash
github-code-search "useFeatureFlag" --org fulll \
  --include-archived \
  --exclude-template-repositories \
  --exclude-repositories legacy-app \
  --exclude-extracts service-b:src/flags.ts:0

In-TUI filtering ​

In addition to pre-query exclusions, the interactive mode offers a live filter bar (press f) to narrow the displayed results without permanently excluding anything.

Three filter targets ​

Press t (outside filter mode) or Shift+Tab (inside filter mode) to cycle between matching modes:

TargetFilters onUnit visible/hidden
pathFile path substring (default, case-insensitive)Individual file
contentCode fragment returned by GitHub Search (case-insensitive)Individual file
repoFull repository name org/repo (case-insensitive)Entire repo

With repo mode the matching portion of the repository name is highlighted in yellow in the result list.

Regex mode ​

Press Tab inside the filter bar to enable regex matching. The badge updates to [path·regex] (or [content·regex], etc.). If you enter an invalid regular expression, it is treated as matching nothing: the filter will show zero results but the UI remains responsive.

Filter vs. exclusions: when to use which ​

Use the TUI filter for exploration — it has no side effects and can be reset instantly with r.

Use --exclude-repositories / --exclude-extracts for reproducible exclusions that should be encoded in the replay command (e.g. for CI pipelines).

Released under the MIT License.

Released under the MIT License.· Copyright © 2026 fulll