有一种方法来grep的东西在一个Github项目的代码?

我可以拉源和grep它在本地,但我想知道它是否可能通过网络界面或第三方替代方案。

想法吗?


当前回答

要在存储库中搜索,添加URL参数/搜索?Q =search_terms在repo的根目录,例如:

https://github.com/bmewburn/vscode-intelephense/search?q=phpstorm

在上面的例子中,它在Code中返回2个结果,在Issues中返回160个结果。

其他回答

谷歌允许您在项目中搜索,但不包括代码:(

网站:https://github.com/CreateJS/EaselJS测试

更新

由于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:

有一个非常好的项目叫做github1s @ https://github.com/conwnet/github1s。

基本上,您可以将任何repo的url更改为https://github.com/microsoft/vscode到https://github1s.com/microsoft/vscode,然后您可以使用编辑器中的内置搜索功能,在存储库中搜索任何内容。

只需使用SourceGraph.com,而不是在GitHub搜索,或安装它的扩展:

我搜索源代码内的Github仓库与免费Sourcegraph Chrome扩展

我浏览了SourceForge的Chrome扩展文档,并通过阅读一些Github的Codebase搜索文档来查看我使用Github的搜索引擎本身搜索目录名所需要的东西

在“搜索”框中使用搜索词和“in:”文件。

“搜索”将创建一个下拉框,询问您想要搜索的位置。