github simple operation

 

 

 

Let's take Square's open source Retrofit as an example.

 

Open link:

https://github.com/square/retrofit

 

Then see the following project home page:

 


 

It can be seen that the operations that can be performed on a project are mainly divided into two parts. The first part includes Watch, Star, and Fork. The previous series of these three operations have been introduced, so I won't repeat them here.

 

We focus on the second part, including Code, Issues, Pull requests, Projects, Wiki, Pulse, and Graphs. Next, let's explain one by one.

 

  • Code

This is easy to understand, it is just the code file of your project. Let me explain here that each project usually has an introduction to the project. Just add a README.md file in the root directory of the project, using markdown syntax, GitHub The file is automatically rendered.

 

  • Issues

Issues represent some problems or bugs of the project. It does not mean that fewer Issues are better. The more Issues are resolved, the more positive response the project author or organization is, and the more important the author of the open source project attaches great importance to the project. Let's take a look at the Issues homepage of Retrofit. Up to now, 1305 issues have been closed (solved), and 37 are in open (to be resolved) state. The ratio and speed of solving problems are worth learning by every author of open source projects.

 


 

Similarly, you can raise an issue when you have problems using some open source projects. You can create a new issue by clicking New Issue in the upper right corner. You need to add a title and description. This operation is very simple.

 

  • Pull requests

We all know that the biggest charm of GitHub is that everyone can participate. For example, when others open up a project, each of us can participate in the development and improve together, and this is done through Pull requests, referred to as PR. This can't be demonstrated in Retrofit, so I will use my own project 9GAG on GitHub to show you in detail how to initiate a PR for a project:

 

提前说明下,你必须确保你可以正常向 GitHub 提交代码,如果不可以的话,请看我之前的系列文章。

 

第一步登录你的 GitHub 账号,然后找到你想发起 PR 的项目,这里以 [9GAG](https://github.com/stormzhang/9GAG) 为例,点击右上角的 Fork 按钮,然后该项目就出现在了你自己账号的 Repository 里。

 

请注意,这个项目原本是属于 GitHub 账号 stormzhang 下的,为了演示,我自己又重新注册了另一个账号叫 googdev 单纯为了演示而用。

 

Fork 之后,在账号 googdev 下多了一个 9GAG 的项目,截图显示如下:

 


 

可以看到 Fork 过来的项目标题底部会显示一行小字:fork from stormzhang/9GAG ,除此之外,项目代码跟原项目一模一样,对于原项目来说,相当于别人新建了一个分支而已。

 

第二步,把该项目 clone 到本地,然后修改的 bug 也好,想要新增的功能也好,总之把自己做的代码改动开发完,保存好。为了方便演示,我这里只在原项目的 README.md 文件添加了一行文字:Fork from stormzhang !

 

接着,把自己做的代码改动 push 到 你自己的 GitHub 上去。

 

相信看过我前面教程的同学这一步应该都会,不会的可以滚回去看前面的教程了。

 

第三步,点击你 Fork 过来的项目主页的 Pull requests 页面,

 


 

点击 New pull request 按钮紧接着到如下页面:

 


 

这个页面自动会比较该项目与原有项目的不同之处,最顶部声明了是 stormzhang/9GAG 项目的 master 分支与你 fork 过来的 googdev/9GAG 项目 master 分支所做的比较。

 

然后最顶部可以方便直观的看到到底代码中做了哪些改动,你们也看到我就是加了一句 Fork from stormzhang !

 

同样的我写好标题和描述,然后我们点击中间的 Create pull request 按钮,至此我们就成功给该项目提交了一个 PR。

 

然后就等着项目原作者 review 你的代码,并且决定会不会接受你的 PR,如果接受,那么恭喜你,你已经是该项目的贡献者之一了。

 

  • Projects

这个是最新 GitHub 改版新增的一个项目,这个项目就是方便你把一些 Issues、Pull requests 进行分类,反正我觉得该功能很鸡肋,起码到目前为止基本没人用该功能,你们了解下就好。

 

  • Wiki

一般来说,我们项目的主页有 README.me 基本就够了,但是有些时候我们项目的一些用法很复杂,需要有详细的使用说明文档给开源项目的使用者,这个时候就用到了 Wiki。

 


 

使用起来也很简单,直接 New Page ,然后使用 markdown 语法即可进行编写。

 

  • Pulse

Pulse 可以理解成该项目的活跃汇总。包括近期该仓库创建了多少个 Pull Request 或 Issue,有多少人参与了这个仓库的开发等,都可以在这里一目了然。

 

根据这个页面,用户可以判断该项目受关注程度以及项目作者是否还在积极参与解决这些问题等。

 


 

  • Graphs

Graphs 是以图表的形式来展示该项目的一个整体情况。比如项目的全部贡献人,比如 commits 的围度分析,比如某天代码提交的频繁程度等。

 


 

  • Settings

如果一个项目是自己的,那么你会发现会多一个菜单 Settings,这里包括了你对整个项目的设置信息,比如对项目重命名,比如删除该项目,比如关闭项目的 Wiki 和 Issues 功能等,不过大部分情况下我们都不需要对这些设置做更改。感兴趣的,可以自行看下这里的设置有哪些功能。

 


 

以上就包含了一个 GitHub 项目的一些基本操作

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326456557&siteId=291194637