有一种方法来grep的东西在一个Github项目的代码?
我可以拉源和grep它在本地,但我想知道它是否可能通过网络界面或第三方替代方案。
想法吗?
有一种方法来grep的东西在一个Github项目的代码?
我可以拉源和grep它在本地,但我想知道它是否可能通过网络界面或第三方替代方案。
想法吗?
当前回答
要在存储库中搜索,添加URL参数/搜索?Q =search_terms在repo的根目录,例如:
https://github.com/bmewburn/vscode-intelephense/search?q=phpstorm
在上面的例子中,它在Code中返回2个结果,在Issues中返回160个结果。
其他回答
只需使用SourceGraph.com,而不是在GitHub搜索,或安装它的扩展:
我搜索源代码内的Github仓库与免费Sourcegraph Chrome扩展
我浏览了SourceForge的Chrome扩展文档,并通过阅读一些Github的Codebase搜索文档来查看我使用Github的搜索引擎本身搜索目录名所需要的东西
在“搜索”框中使用搜索词和“in:”文件。
“搜索”将创建一个下拉框,询问您想要搜索的位置。
只需访问该回购的主页,然后在左上方的搜索框中输入您的搜索词。
第一个建议的结果将被标记为“in this repository”。点击它,或者直接按回车键。
GitHub文档说-
匹配文件中出现“Octocat”的代码 内容。 Octocat in:path匹配文件>路径中出现“Octocat”的代码。 Octocat in:file,path匹配>文件内容或文件路径中出现“Octocat”的代码。
更新
由于XHR问题和API更改,下面的bookmarklet黑客被破坏。
值得庆幸的是,Github现在有“一个全新的代码搜索”,它可以出色地完成这项工作。
Checkout this voodoo: Github code search userscript. Follow the directions there, or if you hate bloating your browser with scripts and extensions, use my bookmarkified bundle of the userscript: javascript:(function(){var s='https://raw.githubusercontent.com/skratchdot/github-enhancement-suite/master/build/github-enhancement-suite.user.js',t='text/javascript',d=document,n=navigator,e;(e=d.createElement('script')).src=s;e.type=t;d.getElementsByTagName('head')[0].appendChild(e)})();doIt('');void(''); Save the source above as the URL of a new bookmark. Browse to any Github repo, click the bookmark, and bam: in-page, ajaxified code search. CAVEAT Github must index a repo before you can search it. Abracadabra... Here's a sample search from the annotated ECMAScript 5.1 specification repository: