Skip to content

Commit ab4f945

Browse files
tclemCopilot
andauthored
Fix fork search docs to use is:fork for code search (#60187)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2dd2e2f commit ab4f945

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

content/search-github/searching-on-github/searching-in-forks.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,30 @@ versions:
1313

1414
To show forks in repository search results, add `fork:true` or `fork:only` to your query. For more information, see [AUTOTITLE](/search-github/searching-on-github/searching-for-repositories).
1515

16-
{% ifversion ghes %}Forks are only indexed for code search when they have more stars than the parent repository. You will not be able to search the code in a fork that has fewer stars than its parent. To show forks with more stars than the parent repository in code search results, add `fork:true` or `fork:only` to your query. For more information, see [AUTOTITLE](/search-github/searching-on-github/searching-code).{% endif %}
16+
{% ifversion ghes %}Forks are only indexed for legacy code search when they have more stars than the parent repository. You will not be able to search the code in a fork that has fewer stars than its parent. To show forks with more stars than the parent repository in legacy code search results, add `fork:true` or `fork:only` to your query. For more information, see [AUTOTITLE](/search-github/searching-on-github/searching-code).{% endif %}
1717

1818
> [!NOTE]
1919
> Forks can only be included in repository and code searches.
2020
21+
## Repository search
22+
2123
The `fork:true` qualifier finds all results that match your search query, including forks. The `fork:only` qualifier finds _only_ forks that match your search query.
2224

2325
| Qualifier | Example
2426
| ------------- | -------------
2527
| `fork:true` | [**github fork:true**](https://github.com/search?q=github+fork%3Atrue&type=Repositories) matches all repositories containing the word "github," including forks.
26-
| <code>language:<em>LANGUAGE</em></code> `fork:true` | [**android language:java fork:true**](https://github.com/search?q=android+language%3Ajava+fork%3Atrue&type=Code) matches code with the word "android" that's written in Java, in both forks and regular repositories.
2728
| `fork:only` | [**github fork:only**](https://github.com/search?q=github+fork%3Aonly&type=Repositories) matches all fork repositories containing the word "github."
2829
| <code>forks:><em>n</em></code> `fork:only` | [**forks:>500 fork:only**](https://github.com/search?q=forks%3A%3E500+fork%3Aonly&type=Repositories) matches repositories with more than 500 forks, and only returns those that are forks.
2930

31+
## Code search
32+
33+
{% data variables.product.github %} code search uses `is:fork` instead of `fork:true` to include forked repositories in code search results. To exclude forks, use `NOT is:fork`.{% ifversion code-search-upgrade %} For more information, see [AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax).{% endif %}
34+
35+
| Qualifier | Example
36+
| ------------- | -------------
37+
| `is:fork` | [**android language:java is:fork**](https://github.com/search?q=android+language%3Ajava+is%3Afork&type=code) matches code with the word "android" that's written in Java, in forked repositories.
38+
| `NOT is:fork` | [**android language:java NOT is:fork**](https://github.com/search?q=android+language%3Ajava+NOT+is%3Afork&type=code) matches code with the word "android" that's written in Java, excluding forked repositories.
39+
3040
## Further reading
3141

3242
* [AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)

0 commit comments

Comments
 (0)