Bug report: GitHub commit search API has no way to exclude fork repositories #188372
Replies: 1 comment
-
|
Yeah dude, you are not crazy. This is actually how the commit search API behaves right now. Unlike repository search, commit search does not exclude forks by default. The fork qualifier only works with fork:true or fork:only, and fork:false is inconsistent and often returns nothing. So when the same commit exists in the main repo and its forks, the API returns all of them. That inflates total_count and makes contribution counting messy. There is no clean server side way to exclude forked commits at the moment. What most people end up doing is: • deduplicating results by commit SHA It would honestly make sense for GitHub to support fork:false here for consistency with repository search. Until then, deduping by SHA is the safest workaround. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Summary
The GitHub commit search API (
GET /search/commits) provides no way to exclude commits from forked repositories. This makes it impossible to count a developer's original commits without double-counting commits that also appear in forks.Expected behavior
The
forkqualifier should supportfork:false(or the default behavior should exclude forks), consistent with how repository search works.Actual behavior
forkqualifier only acceptsfork:trueandfork:only(see searching-in-forks).fork:falseis not documented and in practice returns zero results.Impact
total_countis inflated when the same commit SHA appears in both the original repository and one or more forks. There is no query-level workaround; the only option is to paginate all results and deduplicate by SHA client-side, which costs up to 10× more API requests.References
Beta Was this translation helpful? Give feedback.
All reactions