博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
github代码搜索技巧
阅读量:5088 次
发布时间:2019-06-13

本文共 3985 字,大约阅读时间需要 13 分钟。

github是一个非常丰富的资源,但是面对这丰富的资源很多人不知到怎么使用,更谈不上怎么贡献给他,我们需要使用github就要学习使用他的方法,学会了使用的方法,接受了他的这种观点我们才会慢慢的给他贡献自己的力量,这是我自己在学习的时候的一个笔记。现在分享给大家希望能够对一些人有帮助。
 
 / Searching code

github搜索之代码搜索

Searching code

代码搜索

To search for code, use the following search qualifiers in any combination.

Tip: There's a list of  you can add to any search qualifier to further improve your results.

 

Considerations for code search

Due to the complexity of searching code, there are a few restrictions on how searches are performed:

  • Only the default branch is considered. In most cases, this will be the master branch.
  • Only files smaller than 384 KB are searchable.
  • You must always include at least one search term when searching source code. For example, searching for  is not valid, while  is.
  • At most, search results can show two fragments from the same file, but there may be more results within the file.
  • You can't use the following wildcard characters as part of your search query:., : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } []. The search will simply ignore these symbols.

以上是代码搜索中需要注意的一些问题

默认搜索是从master分支搜索代码

只有小于384k的代码才是可以搜索到的

搜索的时候必须包含至少一个搜索关键词 

搜索语句不能有特殊字符如., : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [].

 

 

Scope the search fields

指定搜索方式

 

Matches code where "octocat" appears in the file contents.
搜索文件中有octocat的代码
Matches code where "octocat" appears in the path name.
搜索路径中有octocat的代码
Matches code where "octocat" appears in the file contents or the path name.
搜索路径中有octocat的代码或者文件中有octocat的代码
Matches code with the word "display," that's marked as being SCSS.
搜索用scss写的包含display的代码
Matches code with the word "Integer".
搜索包含Integer的字段

Search by language

通过语言搜索代码

You can search for code based on what language it's written in. For example:

Matches code with the word "element" that's marked as being XML and has exactly 100 bytes.
搜索大小为100字节的xml代码
Matches code from all @mozilla's repositories that's marked as Markdown.
搜索mozilla用户下用markdown写的代码

Search by the number of forks the parent repository has

通过fork的数量或者是否有父节点的方式搜索

 

If you would like forked results to appear, add the fork:true qualifier. For example:

 

Matches code in a forked repository with the word "android" that's written in Java.
搜索用java写的 android相关的代码并且被fork过

The size qualifier filters results based on the size of the file in which the code is found. For example:

Matches code with the word "function," written in Python, in files that are larger than 10 KB.
搜索与function相关的python代码,文件大小超过10kb

Search by the location of a file within the repository

按照目录结构搜索

By including the path qualifier, you specify that resulting source code must appear at a specific location in a repository. Subfolders are considered during the search, so be as specific as possible. For example:

Finds JavaScript files with the word "console" in an 
app/public directory (even if they reside in
app/public/js/form-validators).
app/public directory目录下搜索console关键字
Finds Perl files under 
cgi-bin with the word "form" in them.
搜索cgi-bin目录下包含form的perl代码

Search by filename

通过文件名搜索

You can use the filename qualifier if there's a specific file you're looking for. For example:

Finds *.vimrc* files with the word "commands" in them.
搜索 文件名匹配*.vimrc* 并且包含commands的代码
Finds Ruby files containing the word "minitest" named *test_helper* within the *test* directory.
在test目录中搜索包含minitest且文件名匹配"*test_helper*"的代码

Search by the file extension

根据扩展名来搜索代码

The extension qualifier matches code files with a certain extension. For example:

Matches code with the word "form," under 
cgi-bin, with the 
.pm extension.
搜索cgi-bin目录下以pm为扩展名的代码
Finds files larger than 200 KB that end in 
.css and have the word "icon" in them.
搜索超过200kb包含icon的css代码

Search within a user's or organization's repositories

通过用户或者组织来查找

To grab a list of code from all repositories owned by a certain user or organization, you can use the usersyntax. For getting a list of code from a specific repository, you can use the repo syntax. For example:

转载于:https://www.cnblogs.com/dingxiaoyue/p/4948288.html

你可能感兴趣的文章
Aizu - 1378 Secret of Chocolate Poles (DP)
查看>>
csv HTTP简单表服务器
查看>>
OO设计的接口分隔原则
查看>>
数据库连接字符串大全 (转载)
查看>>
java类加载和对象初始化
查看>>
对于负载均衡的理解
查看>>
django简介
查看>>
window.event在IE和Firefox的异同
查看>>
常见的js算法面试题收集,es6实现
查看>>
IO流写出到本地 D盘demoIO.txt 文本中
查看>>
Windows10 下Apache服务器搭建
查看>>
HDU 5458 Stability
查看>>
左手坐标系和右手坐标系
查看>>
solr后台操作Documents之增删改查
查看>>
http://yusi123.com/
查看>>
文件文本的操作
查看>>
Ubuntu linux下gcc版本切换
查看>>
记一次Web服务的性能调优
查看>>
jQuery.form.js使用
查看>>
(转)linux sort,uniq,cut,wc命令详解
查看>>