-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
CONTRIBUTING.md
108 lines (76 loc) · 2.84 KB
/
CONTRIBUTING.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
title: 如何参与贡献?
---
欢迎大家参与讨论,更欢迎大家多多的回馈社区,来开始共享吧!
## 贡献流程
### 第一步:Fork [https://github.com/talkgo/night](https://github.com/talkgo/night) 项目
1. 访问 [https://github.com/talkgo/night](https://github.com/talkgo/night);
2. 点击 Fork 按钮(顶部右侧),建立基于此的分支;
### 第二步:克隆分支到你本地
```sh
# Define a local working directory:
$ working_dir=/.../src/github.com/talkgo
$ user={your github profile name}
$ mkdir -p $working_dir
$ cd $working_dir
$ git clone https://github.com/$user/night-reading-go.git
$ cd $working_dir/night-reading-go
$ git remote -v
origin https://github.com/$user/night-reading-go.git (fetch)
origin https://github.com/$user/night-reading-go.git (push)
$ git remote add upstream https://github.com/talkgo/night.git
$ git remote -v
origin https://github.com/$user/night-reading-go.git (fetch)
origin https://github.com/$user/night-reading-go.git (push)
upstream https://github.com/talkgo/night.git (fetch)
upstream https://github.com/talkgo/night.git (push)
# Never push to upstream master since you do not have write access.
$ git remote set-url --push upstream no_push
$ git remote -v
origin https://github.com/$user/night-reading-go.git (fetch)
origin https://github.com/$user/night-reading-go.git (push)
upstream https://github.com/talkgo/night.git (fetch)
upstream no_push (push)
```
### 第三步:分支
让你本地 master 分支保持最新:
```sh
$ cd $working_dir/night-reading-go
$ git fetch upstream
$ git checkout master
$ git rebase upstream/master
```
从 master 开分支:
```sh
$ git checkout -b myfeature
```
### 第四步:开发
#### 编辑代码
你现在能在 `myfeature` 分支上编辑代码/文档了。
请按照以下一些格式编写:
文件命名:`2018-08-03-contributing.md`;
文件的图片:放到 `static/images` 下;
文件内容:需要明确标题、日期等基本信息;
### 第五步:保持分支同步
```sh
# While on your myfeature branch.
$ git fetch upstream
$ git rebase upstream/master
```
### 第六步:提交
提交你的修改:
```sh
$ git commit
```
请参考 [Git Commit 规范指南](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit?pref=2&pli=1#)。
### 第七步:推送
准备好审核:
```sh
git push -f origin myfeature
```
### 第八步:创建一个 pull request
1. 访问你 fork 的 [https://github.com/$user/night-reading-go](https://github.com/$user/night-reading-go) (替换 $user);
2. 点击 myfeature 分支旁边的 Compare & pull request 按钮;
### 第九步:获取代码审核
一旦你的 Pull Request 被打开,它将被分配给审核者。
这些审核人员将进行彻底的代码审查,寻找正确性,错误,改进机会,文档和评论以及样式。