Search commits

GET {{baseUrl}}/search/commits?q=<string>&sort=<string>&order=desc&per_page=30&page=1

Find commits via various criteria on the default branch (usually master). This method returns up to 100 results per page.

When searching for commits, you can get text match metadata for the message field when you provide the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to find commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:

q=repo:octocat/Spoon-Knife+css

Request Params

KeyDatatypeRequiredDescription
qstring(Required) The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching commits" for a detailed list of qualifiers.
sortstringSorts the results of your query by author-date or committer-date. Default: best match
orderstringDetermines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.
per_pagenumberResults per page (max 100)
pagenumberPage number of the results to fetch.

RESPONSES

status: OK

{&quot;total_count&quot;:1,&quot;incomplete_results&quot;:false,&quot;items&quot;:[{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f&quot;,&quot;sha&quot;:&quot;bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Spoon-Knife/commit/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f&quot;,&quot;comments_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f/comments&quot;,&quot;commit&quot;:{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f&quot;,&quot;author&quot;:{&quot;date&quot;:&quot;2014-02-04T14:38:36-08:00&quot;,&quot;name&quot;:&quot;The Octocat&quot;,&quot;email&quot;:&quot;octocat@nowhere.com&quot;},&quot;committer&quot;:{&quot;date&quot;:&quot;2014-02-12T15:18:55-08:00&quot;,&quot;name&quot;:&quot;The Octocat&quot;,&quot;email&quot;:&quot;octocat@nowhere.com&quot;},&quot;message&quot;:&quot;Create styles.css and updated README&quot;,&quot;tree&quot;:{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/trees/a639e96f9038797fba6e0469f94a4b0cc459fa68&quot;,&quot;sha&quot;:&quot;a639e96f9038797fba6e0469f94a4b0cc459fa68&quot;},&quot;comment_count&quot;:8},&quot;author&quot;:{&quot;login&quot;:&quot;octocat&quot;,&quot;id&quot;:583231,&quot;node_id&quot;:&quot;MDQ6VXNlcjU4MzIzMQ==&quot;,&quot;avatar_url&quot;:&quot;https://avatars.githubusercontent.com/u/583231?v=3&quot;,&quot;gravatar_id&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://api.github.com/users/octocat&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat&quot;,&quot;followers_url&quot;:&quot;https://api.github.com/users/octocat/followers&quot;,&quot;following_url&quot;:&quot;https://api.github.com/users/octocat/following{/other_user}&quot;,&quot;gists_url&quot;:&quot;https://api.github.com/users/octocat/gists{/gist_id}&quot;,&quot;starred_url&quot;:&quot;https://api.github.com/users/octocat/starred{/owner}{/repo}&quot;,&quot;subscriptions_url&quot;:&quot;https://api.github.com/users/octocat/subscriptions&quot;,&quot;organizations_url&quot;:&quot;https://api.github.com/users/octocat/orgs&quot;,&quot;repos_url&quot;:&quot;https://api.github.com/users/octocat/repos&quot;,&quot;events_url&quot;:&quot;https://api.github.com/users/octocat/events{/privacy}&quot;,&quot;received_events_url&quot;:&quot;https://api.github.com/users/octocat/received_events&quot;,&quot;type&quot;:&quot;User&quot;,&quot;site_admin&quot;:false},&quot;committer&quot;:{},&quot;parents&quot;:[{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/commits/a30c19e3f13765a3b48829788bc1cb8b4e95cee4&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Spoon-Knife/commit/a30c19e3f13765a3b48829788bc1cb8b4e95cee4&quot;,&quot;sha&quot;:&quot;a30c19e3f13765a3b48829788bc1cb8b4e95cee4&quot;}],&quot;repository&quot;:{&quot;id&quot;:1300192,&quot;node_id&quot;:&quot;MDEwOlJlcG9zaXRvcnkxMzAwMTky&quot;,&quot;name&quot;:&quot;Spoon-Knife&quot;,&quot;full_name&quot;:&quot;octocat/Spoon-Knife&quot;,&quot;owner&quot;:{&quot;login&quot;:&quot;octocat&quot;,&quot;id&quot;:583231,&quot;node_id&quot;:&quot;MDQ6VXNlcjU4MzIzMQ==&quot;,&quot;avatar_url&quot;:&quot;https://avatars.githubusercontent.com/u/583231?v=3&quot;,&quot;gravatar_id&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://api.github.com/users/octocat&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat&quot;,&quot;followers_url&quot;:&quot;https://api.github.com/users/octocat/followers&quot;,&quot;following_url&quot;:&quot;https://api.github.com/users/octocat/following{/other_user}&quot;,&quot;gists_url&quot;:&quot;https://api.github.com/users/octocat/gists{/gist_id}&quot;,&quot;starred_url&quot;:&quot;https://api.github.com/users/octocat/starred{/owner}{/repo}&quot;,&quot;subscriptions_url&quot;:&quot;https://api.github.com/users/octocat/subscriptions&quot;,&quot;organizations_url&quot;:&quot;https://api.github.com/users/octocat/orgs&quot;,&quot;repos_url&quot;:&quot;https://api.github.com/users/octocat/repos&quot;,&quot;events_url&quot;:&quot;https://api.github.com/users/octocat/events{/privacy}&quot;,&quot;received_events_url&quot;:&quot;https://api.github.com/users/octocat/received_events&quot;,&quot;type&quot;:&quot;User&quot;,&quot;site_admin&quot;:false},&quot;private&quot;:false,&quot;html_url&quot;:&quot;https://github.com/octocat/Spoon-Knife&quot;,&quot;description&quot;:&quot;This repo is for demonstration purposes only.&quot;,&quot;fork&quot;:false,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife&quot;,&quot;forks_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/forks&quot;,&quot;keys_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/keys{/key_id}&quot;,&quot;collaborators_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/collaborators{/collaborator}&quot;,&quot;teams_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/teams&quot;,&quot;hooks_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/hooks&quot;,&quot;issue_events_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/issues/events{/number}&quot;,&quot;events_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/events&quot;,&quot;assignees_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/assignees{/user}&quot;,&quot;branches_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/branches{/branch}&quot;,&quot;tags_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/tags&quot;,&quot;blobs_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/blobs{/sha}&quot;,&quot;git_tags_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/tags{/sha}&quot;,&quot;git_refs_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/refs{/sha}&quot;,&quot;trees_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/trees{/sha}&quot;,&quot;statuses_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/statuses/{sha}&quot;,&quot;languages_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/languages&quot;,&quot;stargazers_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/stargazers&quot;,&quot;contributors_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/contributors&quot;,&quot;subscribers_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/subscribers&quot;,&quot;subscription_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/subscription&quot;,&quot;commits_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/commits{/sha}&quot;,&quot;git_commits_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/git/commits{/sha}&quot;,&quot;comments_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/comments{/number}&quot;,&quot;issue_comment_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/issues/comments{/number}&quot;,&quot;contents_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/contents/{+path}&quot;,&quot;compare_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/compare/{base}...{head}&quot;,&quot;merges_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/merges&quot;,&quot;archive_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/{archive_format}{/ref}&quot;,&quot;downloads_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/downloads&quot;,&quot;issues_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/issues{/number}&quot;,&quot;pulls_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/pulls{/number}&quot;,&quot;milestones_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/milestones{/number}&quot;,&quot;notifications_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/notifications{?since,all,participating}&quot;,&quot;labels_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/labels{/name}&quot;,&quot;releases_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/releases{/id}&quot;,&quot;deployments_url&quot;:&quot;https://api.github.com/repos/octocat/Spoon-Knife/deployments&quot;},&quot;score&quot;:1,&quot;node_id&quot;:&quot;MDQ6VXNlcjU4MzIzMQ==&quot;}]}