gpt4 book ai didi

search - 在 github.com 上搜索代码片段存储库

转载 作者:行者123 更新时间:2023-12-03 01:15:22 24 4
gpt4 key购买 nike

如何在 github.com 上搜索代码片段?当我在存储库中搜索 MSG_PREPARE 时,ErikZalm/Marlin github 显示 nothing

我正在使用 https://github.com/search 中描述的存储库代码搜索语法与

repo:ErikZalm/Marlin MSG_PREPARE

没有结果,但可以在此存储库中找到 MSG_PREPARE here 。我错过了什么吗? github.com上没有代码搜索吗?

最佳答案

在撰写此答案时,与提出此问题的时间(即大约 8 年前)相比,github 已经取得了很好的进展,尽管仍没有达到您所看到的长度。

GitHub 代码搜索受以下规则限制:https://docs.github.com/en/github/searching-for-information-on-github/searching-code 。引用相同内容:

Code in forks is only searchable if the fork has more stars than the parent repository.
Forks with fewer stars than the parent repository are not indexed for code search.
To include forks with more stars than their parent in the search results, you will need to add fork:true or fork:only to your query.
For more information, see "Searching in forks."

因此,我们可以使用 fork:true 选项在 fork 内进行搜索,尽管正如预期的那样,因为与父项相比,存储库 ErikZalm/Marlin 的星数较少MarlinFirmware/Marlin,fork 中的代码仍然没有索引。因此advance search shows no good except a match to the repo.

但是,如果您对父级执行相同的搜索,它将显示代码上的匹配项。 Here are the matches for MSG_PREPARE in the parent repo MarlinFirmware/Marlin

幸运的是,据我所知,SourceGraph 是从事该领域工作的一家公司:https://about.sourcegraph.com/

因此,您可以使用 SourceGraph 轻松搜索您想要的内容: Here are the matches for MSG_PREPARE in the ErikZalm/Marlin using SourceGraph Cloud

关于search - 在 github.com 上搜索代码片段存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13321936/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com