github作为全球最大的代码托管网站,受到世界上广大码农的追捧。在这里你可以发现很多很棒的开源项目,也可以构建免费的私人仓库,简直就是一个学习成长的乐园。下面就一些常见的github操作进行如下总结:

一、github初了解

github将所有的改动行为称为contributions,包括commit,pr, code review,isssue,fork等等。github有个叫活动概览(Activity overview)的功能,将contributions按照下面四个象限进行分类统计:

  • Commits:建仓、提交代码或fork等会触发
  • Pull requests:指开发者在本地对源代码进行更改后,向 GitHub 中托管的 Git 仓库请求合并的功能。
  • Code review:预览代码
  • Issues:用于 BUG 报告、功能添加、方向性讨论等,将这些以 Issue 形式进行管理。

二、Github使用技巧:

很多人搜索github,但是芸芸众生,要找到自己想要的项目犹如海底捞针一般,今天教大家几项神技,可以快速找到自己想要的内容。

1、按star数目搜索,比如JavaScript,要求星数,这样就能获取star数目最多的项目

2、follow一些github上面的大牛

请登录:https://github-ranking.com/

国内大牛:http://outofmemory.cn/github/

这里是搜索名人的网址:https://github.com/search

高级搜索:https://github.com/search/advanced

3、Awesome + 你的关键字:搜索一些优秀的框架、教程、项目等

4、看一些搜索技巧,设定条件进行搜索

地址:https://help.github.com/articles/searching-repositories/

5、通过readme看看人家是否发出pull request

看看这篇文章:http://blog.csdn.net/qianlong4526888/article/details/11529981

6、看explore推荐

https://github.com/explore

7、看看其他

http://blog.sina.com.cn/s/blog_4e60b09d0102vcso.html

8、直接github上搜fackbook或者其他,可以看到他们的最新作品

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

三、github搜索之代码搜索(Search / Searching code)

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 language:go is not valid, while amazinglanguage:go 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的代码才是可以搜索到的

搜索的时候必须包含至少一个搜索关键词 如amazing language:go

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

Scope the search fields

指定搜索方式

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

Search by language

通过语言搜索代码

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

Search by the number of forks the parent repository has

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

  • 搜索用java写的 android相关的代码并且被fork过--android language:java fork:true (Matches code in a forked repository with the word "android" that's written in Java.)
  • 搜索与function相关的python代码,文件大小超过10kb--function size:>10000 language:python (Matches code with the word "function," written in Python, in files that are larger than 10 KB.)

Search by the location of a file within the repository

按照目录结构搜索

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

Search by filename

通过文件名搜索

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

Search by the file extension

根据扩展名来搜索代码

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

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 user syntax. For getting a list of code from a specific repository, you can use the repo syntax. For example:

  • user:github extension:rb

四、推荐项目:

  • free-programming-books

这个项目目前 star 数排名 GitHub 第三,总 star 数超过6w,这个项目整理了所有跟编程相关的免费书籍,而且全球多国语言版的都有,中文版的在这里:free-programming-books-zh,有了这个项目,理论上你可以获取任何编程相关的学习资料,强烈推荐给你们!

  • oh-my-zsh

俗话说,不会用 shell 的程序员不是真正的程序员,所以建议每个程序员都懂点 shell,有用不说,装逼利器啊!而 oh-my-zsh 毫无疑问就是目前最流行,最酷炫的 shell,不多说了,懂得自然懂,不懂的以后你们会懂的!

  • awesome

GitHub 上有各种 awesome 系列,简单来说就是这个系列搜罗整理了 GitHub 上各领域的资源大汇总,比如有 awesome-android, awesome-ios, awesome-java, awesome-Python 等等。

  • github-cheat-sheet

GitHub 的使用有各种技巧,只不过基本的就够我们用了,但是如果你对 GitHub 超级感兴趣,想更多的了解 GitHub 的使用技巧,那么这个项目就刚好是你需要的,每个 GitHub 粉都应该知道这个项目。

五、加载慢,访问不了

针对Windows下访问GitHub慢,有些图片加载不全的情况,进行如下处理

(1)查看IP:打开DNS查询网站,分别查github.com、github.githubassets.com、avatars0.githubusercontent.com

(2)修改hosts文件

利用记事本或者notepad++打开C:\Windows\System32\drivers\etc\hosts(修改前可以先另存为一份,保证出错能恢复),然后添加以下内容

# GitHub Start192.30.253.113  github.com185.199.109.154 github.githubassets.com185.199.111.154 github.githubassets.com203.98.7.65     gist.github.com151.101.108.133 assets-cdn.github.com151.101.108.133 raw.githubusercontent.com151.101.108.133 gist.githubusercontent.com151.101.108.133 cloud.githubusercontent.com151.101.108.133 camo.githubusercontent.com151.101.108.133 avatars0.githubusercontent.com151.101.108.133 avatars1.githubusercontent.com151.101.108.133 avatars2.githubusercontent.com151.101.108.133 avatars3.githubusercontent.com151.101.108.133 avatars4.githubusercontent.com151.101.108.133 avatars5.githubusercontent.com151.101.108.133 avatars6.githubusercontent.com151.101.108.133 avatars7.githubusercontent.com151.101.108.133 avatars8.githubusercontent.com
# GitHub End

(3)刷新DNS

在cmd中输入ipconfig /flushdns即可刷新,然后重启浏览器,不行的话再重启电脑,这样就能成功打开github了,所有图片和内容都能加载。

在gitee上有大佬总结了访问策略,具体可查看链接:

https://gitee.com/docmirror/dev-sidecar

六、加速下载

有时候需要在GitHub下载一些开源项目,但是直接下网速慢到爆炸,这时候需要借助一些手段对其进行下载加速,常见的有几种方法:

  • 码云(需注册),这是一个仿github的代码托管平台,通过导入目标开源项目,然后在下载。

  • 另一个平台:https://githubd.com/#/,无需注册,直接拷贝目标项目链接就可以快速下载。(已失效)

  • Github 加速下载:GitHub 加速下载 - 在线工具

将github上项目链接复制到输入框中就可以代理加速下载!

  • 打开网站 GitHub Proxy 代理加速,粘贴链接直接下载,或者直接在后台使用下面加速指令
git clone https://ghproxy.com/https://github.com/stilleshan/ServerStatus  ###下载链接前添加https://ghproxy.com即可git clone git://ghproxy.com/https://github.com/stilleshan/ServerStatus ###加速方法二git clone https://github.com.cnpmjs.org/stilleshan/ServerStatus   ###加速方法三git clone https://hub.fastgit.org/stilleshan/ServerStatus   ###加速方法四git clone https://github.91chi.fun//https://github.com/stilleshan/ServerStatus   ###加速方法五

但是上面几种方法都没办法解决从github上下载一些release的打包文件,故有大佬又针对性的开发了新的加速方法,

  • 可以拷贝下载链接通过Unlock, speed up and easily transfer content from the cloud - Offcloud.com 下载,但是需要先注册,速度还可以。
  • 这个网站下载,可以直接使用,不要注册,大家直接copy链接上手

七、针对下载

》有时候我们会碰到下载指定分支的github开源项目(默认git clone的是最新的),这时候就可以借助下面指令实现

git clone -b application https://hub.fastgit.org/PaddlePaddle/PaddleVideo.git  ##b后接上分支名

》如果下载 Github 上某些代码仓库时,如果代码仓库中具有很多子模块,正常使用git clone —-recursive下载方式,具体如下

git clone --recursive https://github.com/onnx/onnx-mlir.git

八、查看代码

对于github上面的项目代码,除了download到本地进行查看,还可以轻松实现在线代码阅读,常见的方法如下,

(1)直接将代码链接中的github.com换成github1s.com即可。

(2)安装octree或者sourcegraph插件实现code在线浏览

哈哈哈,就先写到这,有兴趣的可以关注我的公众号,大家一起学习啦!


补充:代码搜索网站:

  • 代码:
    GitHub
    Codase
    Ohloh
    krugle
    Merobase Component Finder
    Google Code Archive
  • SymbolHound
    可以搜索特殊符号的搜索引擎,程序员的福音,遇到 Bash、正则之类的问题时候的利器!
  • Hoogle
    Haskell 的专用函数搜索引擎,妈妈再也不用担心我的 Functional Programming
  • RSeek.org R-project Search Engine
    R 语言专用搜索。
  • findjar.com
    JAR 搜索引擎,对 Java 编程有帮助。
  • Microsoft Research
    微软内部搜索,好东西多多,经常会发现 Google 学术搜不到的技术文献
  • 针对 SEO 排名的知识搜索引擎:SEO优化网,完全在线学习 + 公式化结构化的 SEO 搜索算法
  • CA App Synthetic Monitor网站监控服务
    从世界各地查询网站的 Ping 结果。

补:

知道如何下载github指定版本的开源项目么,那么你可能会用到下面指令,以yolov5为例

git clone -b v4.0 https://github.com/ultralytics/yolov5.git
git clone -b yolov5-v4.0 https://github.com/wang-xinyu/tensorrtx.git

参考链接:

如何发现优秀的开源项目?_warmor的专栏-CSDN博客(如何发现优秀的开源项目)

GitHub项目、代码搜索、使用等技巧相关推荐

  1. octotree插件 --- 将 Github 项目代码以树形格式展示

    简介 octotree 是一款chrome插件,它可以将 GitHub 项目代码以树形格式进行展示,非常适合我们探索项目源,并且我们可以下载指定的文件,而无需将整个项目都下载下来. octotree下 ...

  2. Octotree | 树形展示 GitHub 项目代码结构

    经常逛 GitHub 的你,是不是有这样一种困惑,每次看到一个项目,想看下项目代码结构,需要一层一层点进去,想看别的目录,又得返回去,效率太低了. 今天推荐的工具是「Octotree」,它能解决以上困 ...

  3. github 检查代码质量_07. 改善 GitHub 项目代码质量:测试

    改善 GitHub 项目代码质量:测试 TDD 虽然接触的TDD时间不算短,然而真正在实践TDD上的时候少之又少.除去怎么教人TDD,就是与人结对编程时的switch,或许是受限于当前的开发流程. 偶 ...

  4. 【PC工具】chrome插件: Github 项目代码树形格式展示工具octotree

    今天给大家分享一个非常好用的查看Github 项目的工具:octotree .可以在Github左侧显示工程目录,浏览工程非常方便.如下图所示 如上图所示,将GitHub项目在浏览器左侧以树状显示(和 ...

  5. 分布式版本控制系统Git的下载、安装与使用其复制GitHub项目代码的方法

      本文介绍分布式开源版本控制系统Git的下载.安装,并基于Git实现克隆GitHub中项目代码的方法.   Git是一款开源软件,因此我们直接在Git的官方下载地址(https://git-scm. ...

  6. 用git来下载github项目代码

    最近要进行课程设计,但是查看代码时想把github的代码下载下来直接导入怎么下载 这就要用到我们的git代码托管了 只需要下载这个git git连接下载 选择一个版本进行下载 选择下面带有时间的进行新 ...

  7. android简单项目及代码_Android 开源项目 (AOSP) 代码搜索工具正式发布

    我们非常高兴的为各位开发者们介绍一个 Android 开源项目 (AOSP) 的代码搜索工具: https://cs.android.com Android 开源项目的代码由一系列 Git 管理的代码 ...

  8. 在linux下载github代码,linux 定时下载github最新代码

    场景:网站的代码在github上托管,静态网站部署在服务器上,每次自己修改完本地代码后,提交到github上,需要自己去服务器上执行git pull 拉取最新代码, 为了解决这种操作,自己再服务器上  ...

  9. java外挂源码_2.7 万 Star!Github 项目源码辅助阅读神器

    [导语]:一款用于将 Github 项目代码以树形格式展示的浏览器插件. 简介 大家平时逛 GitHub 是否会觉得查看源代码的体验十分糟糕?项目文件需要一层层点击,返回也要一层层返回.这样不直观,也 ...

最新文章

  1. php5.3.6安装教程,apache2.2.19+php5.3.6配置教程
  2. ubuntu安装pip3
  3. 烂泥:kickstart无人值守安装CentOS6.5
  4. Tensorflow安装后,import时出现错误:ImportError: DLL load failed: 找不到指定的模块
  5. php5.3的新特性
  6. 今天又看到的Acm指南
  7. BN究竟起了什么作用?一个闭门造车的分析
  8. web公选课js基础Part1
  9. SSH框架之SSH前言
  10. php form validator 下单,PHP Form表单验证:PHP form validator使_php
  11. Major GC 是清理老年代。 Full GC 是清理整个堆空间—包括年轻代和老年代。
  12. 磁盘工具无法修复磁盘怎么办
  13. C向Python传递数组参数时,调用函数后才能销毁
  14. rapidxml往xml文件循环写入内容
  15. 染色问题java_java地图路径染色寻找算法
  16. PC端视频录制软件大集合,总有一款是你喜欢的
  17. linux中文件夹的作用
  18. 屏幕录制专家,如何上传到优酷的高清视频?
  19. 如何旋转PDF页面?两招教你轻松搞定
  20. 亚朵更新招股书:继续推进纳斯达克上市,已提前“套现”2060万元

热门文章

  1. [置顶] 中国象棋程序的设计与实现(高级版)(项目截图)
  2. jquery入门介绍
  3. 遍历对象Object的两类方法
  4. sql注入pythonpoco_SQL注入原理与解决方法代码示例
  5. Linux下ll命令
  6. verilog学习:一个简单的入门verilog例子
  7. 什么是对象,如何面向对象,为什么要面向对象
  8. 果蝇优化算法(FOA)
  9. 【C++】栈的应用:逆波兰式的实现
  10. python宇晨_第三十届全国青少年科技创新大赛青少年科技创意作品中学组.PDF