目錄
github 搜索技巧
參考自 B站 up 主 CodeSheep 的視頻【如何高效地在網上找開源項目做!在職程序員實際演示一波視頻教程操作】,然后寫着寫着一好奇就去看文檔了
現在這篇博客相當於官方文檔的翻譯版😂
當然,你也可以去看【官方文檔】體驗原汁原味的教程
干啥的?相當於給搜索結果添加過濾條件,看下下面的案例你就知道啦,過濾 github 的搜索結果,更精確搜索項目
案例
普通搜
關鍵詞:python
搭配技巧搜
搜索 github 中,項目描述(description)中有 python 並且 2019-12-20 號之后有更新過的項目
in:description python pushed:>2019-12-20
效果:加了限制條件后,查出來的項目數有了明顯的減少
限定詞
可通過指定
倉庫名(repository name)、項目描述(description)、內容(contents)、說明文件(readme.md)
來搜索項目
限定詞 | 案例 |
---|---|
in:name |
in:name python 查出倉庫名中有 python 的項目(python in:name 也是一樣的) |
in:description |
in:name,description python 查出倉庫名或者項目描述中有 python 的項目 |
in:readme |
in:readme python 查出 readme.md 文件里有 python 的項目 |
repo:owner/name |
repo:octocat/hello-world 查出 octocat 的 hello-world 項目(指定了某個人的某個項目) |
其他騷操作?自己看官方文檔(感覺用不到,就不整理了吧):【找倉庫中的某個文件】、【在 github 上查找代碼片段】
查找某個用戶或組織的項目
限定詞 | 案例 |
---|---|
user:USERNAME |
user:1335951413 stars:<10 查出用戶 1335951413 名下 stars 少於 10 的項目 |
org:ORGNAME |
org:github 查出 github 名下的項目 |
輔助限定詞
可以通過限制
項目大小(size)、擁護者數(followers)、fork數(forks)、stars數(stars)、創建時間(created)、更新時間(pushed)、項目所用語言(language)、topic標簽(topic)、topic標簽數(topics)...
來篩選項目輔助限定詞可以多個並用,用空格隔開就行,可以搭配限定詞使用,也可單獨使用
(關於項目是否被 fork 這個點我不是很懂,就不寫案例了)
in:name python size:<=1000
查出項目名字中有 python 且小於 1MB 的項目
size:<=1000
查出項目大小小於 1MB 的項目
限定詞 | 案例 |
---|---|
stars:n |
stars:>=5 查出 star數大於等於 5 個 的項目(支持大於小於區間等) |
pushed:YYYY-MM-DD |
css pushed:>2013-02-01 查出倉庫中包含 css 關鍵字,並且在 2013年1月 之后更新過的項目 |
language:LANGUAGE |
rails language:javascript 查出倉庫包含 rails 關鍵字,並且使用 javscript 語言的項目 |
created:YYYY-MM-DD |
webos created:<2011-01-01 查出倉庫中包含 webos 關鍵字並且是在 2011 年之前創建的項目(也支持時分秒,支持大於小於區間等) |
size:n |
size:1000 查出倉庫大小等於 1MB 的項目size:>=30000 查出倉庫大小至少大於 30MB 的項目size:50..120 查出倉庫大小在 50KB 至 120KB 之間的項目 |
followers:n |
followers:1000 查出有 1000 個擁護者(followers) 的項目(支持大於小於區間等) |
forks:n |
forks:5 查出有 5 個 forks 的項目(支持大於小於區間等) |
topic:TOPIC |
topic:jekyll 查出含有 jekyll 這個 topic 的項目(項目描述下面的東西,相當於標簽、分類) |
topics:n |
topics:>5 查出有 5 個以上 topic 的項目(支持大於小於區間等) |
archived:true/false |
archived:true GNOME 查出已經封存了並且含有 GNOME 關鍵字的項目(已經不再維護了的項目) |
is:public/private |
is:public org:github 查出倉庫所有組織是 github 並且公開的項目is:private github 查出含有 github 關鍵字並且是私有的項目(私有的別人看不到,所以這個是用來搜索自己的私有項目的) |
license:LICENSE_KEYWORD |
license:apache-2.0 查出倉庫的開源協議是 apache-2.0 的 |
還沒搞懂的(關於 forks、mirror、issues)
stars:>=500 fork:true language:php matches repositories with the at least 500 stars, including forked ones, that are written in PHP.
- case pushed:>=2013-03-06 fork:only matches repositories with the word "case" that were pushed to on or after March 6th, 2013, and that are forks.
- mirror:true GNOME matches repositories that are mirrors and contain the word "GNOME." 查出是鏡像並且包含 GNOME 關鍵字的項目(github 上 mirror 啥意思不太懂)
- mirror:false GNOME matches repositories that are not mirrors and contain the word "GNOME."
- good-first-issues:>2 javascript matches repositories with more than two issues labeled
good-first-issue
and that contain the word "javascript." help-wanted-issues:>4 react matches repositories with more than four issues labeled
help-wanted
and that contain the word "React."
排序(放的是官網的鏈接)
推薦直接在頁面上的搜索結果點擊排序,何必再去學一手呢?
官網文檔:【給你的查詢結果排序】
使用指南
自己靈活的使用限定詞和輔助限定詞寫出一套規則即可查出你想要的項目
他們的位置先后、數量都無所謂,加上只是多了一個條件
練習案例
常用到的其實有就是這些,上面的還是太多了,你有那個需求,又找不到方式的時候可以查查看
# 項目名字(name)里有 python 的
in:name python
# 名字(name)里有 python 的並且 stars 大於 3000 的
in:name python starts:>3000
# 名字(name)里有 python 的並且 stars 大於 3000 、forks 大於 200 的
in:name python starts:>3000 forks:>200
# 詳情(readme)里面有 python 的並且 stars 大於 3000 的
in:readme python starts:>3000
# 描述(description)里面有 python 的並且 stars 大於 3000 的
in:description python starts:>3000
# 描述(description)里面有 python 的並且是 python 語言的
in:description python language:python
# 描述(description)里面有 python 的並且 2019-12-20 號之后有更新過的
in:description python pushed:>2019-12-20
原文地址: https://www.cnblogs.com/suwanbin/p/12113751.html