Skip to main content
Glama

githubSearchCommits

Search GitHub commits by message, author, hash, or date to retrieve SHAs or fetch content changes (diffs/patches). Use query-based, filter-only, or combined searches for precise results. Works for public and private repositories, with optional commit content fetching.

Instructions

Search GitHub commits by message, author, hash, or date. Returns SHAs for github_fetch_content (branch=SHA). Can fetch commit content changes (diffs/patches) when getChangesContent=true.

SEARCH OPTIONS:

  1. Query-based search:

    • exactQuery: Exact phrase matching (e.g., "bug fix")

    • queryTerms: Multiple keywords with AND logic (e.g., ["readme", "typo"])

    • orTerms: Keywords with OR logic (e.g., ["bug", "fix"] finds commits with either)

    • Combine: queryTerms=["api"] + orTerms=["auth", "login"] = api AND (auth OR login)

  2. Filter-only search (no query required):

    • Search by author, committer, hash, date, etc.

    • Example: Just committer="monalisa" to find all commits by that user

    • Example: Search by commit hash (including head_sha/base_sha from a PR): hash=""

  3. Combined search:

    • Mix queries with filters for precise results

    • Example: queryTerms=["fix"] + author="jane" + author-date=">2023-01-01"

EXAMPLES: • Search commits with "readme" AND "typo": queryTerms=["readme", "typo"] • Search exact phrase "bug fix": exactQuery="bug fix" • Search by committer only: committer="monalisa" • Search by author name: author-name="Jane Doe" • Search by commit hash (including head_sha/base_sha from a PR): hash="8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3" • Search before date: author-date="<2022-02-01"

CONTENT FETCHING:

  • Set getChangesContent=true to fetch actual commit changes: • Gets file diffs and patches for up to 10 commits • Shows changed files, additions, deletions • Includes code patches (first 1000 chars) • Works for both public AND private repositories • Most effective when owner and repo are specified

TOKEN OPTIMIZATION NOTICE:

  • getChangesContent=true is EXTREMELY expensive in tokens

  • Each commit's diff/patch content consumes significant tokens

  • Limited to 1000 characters per patch and 5 files per commit for efficiency

  • Use sparingly and only when code changes are essential to your task

  • use fetch_github_file_content to get the full content of the file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authorNoGitHub username of commit author (e.g., "octocat")
author-dateNoFilter by author date (e.g., "<2022-02-01", ">2020-01-01", "2020-01-01..2021-01-01")
author-emailNoEmail of commit author
author-nameNoFull name of commit author
committerNoGitHub username of committer (e.g., "monalisa")
committer-dateNoFilter by commit date (e.g., "<2022-02-01", ">2020-01-01", "2020-01-01..2021-01-01")
committer-emailNoEmail of committer
committer-nameNoFull name of committer
exactQueryNoExact phrase to search for in commit messages (e.g., "bug fix")
getChangesContentNoSet to true to fetch actual commit changes (diffs/patches). Works for both public and private repositories, most effective with owner and repo specified. Limited to first 10 commits for rate limiting. WARNING: EXTREMELY expensive in tokens - each commit diff can consume thousands of tokens.
hashNoCommit SHA (full or partial, including head_sha/base_sha from a PR as returned by github_search_pull_requests)
limitNoMaximum number of results to fetch
mergeNoOnly merge commits (true) or exclude them (false)
orTermsNoArray of search terms with OR logic (e.g., ["bug", "fix"] finds commits with either word)
orderNoSort orderdesc
ownerNoRepository owner (use with repo param)
parentNoParent commit SHA
queryTermsNoArray of search terms with AND logic (e.g., ["readme", "typo"] finds commits with both words)
repoNoRepository name (use with owner param)
sortNoSort by date field
treeNoTree SHA
visibilityNoRepository visibility filter

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bgauryy/octocode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server