GH-SEARCH-CODE(1) | GitHub CLI manual | GH-SEARCH-CODE(1) |
gh-search-code - Search within code
gh search code <query> [flags]
Search within code in GitHub repositories.
The search syntax is documented at:
⟨https://docs.github.com/search-github/searching-on-github/searching-code⟩
Note that these search results are powered by what is now a legacy GitHub code search engine. The results might not match what is seen on github.com, and new features like regex search are not yet available via the GitHub API.
# search code matching "react" and "lifecycle" $ gh search code react lifecycle # search code matching "error handling" $ gh search code "error handling" # search code matching "deque" in Python files $ gh search code deque --language=python # search code matching "cli" in repositories owned by microsoft organization $ gh search code cli --owner=microsoft # search code matching "panic" in the GitHub CLI repository $ gh search code panic --repo cli/cli # search code matching keyword "lint" in package.json files $ gh search code lint --filename package.json
gh-search(1)
Nov 2024 |