Skip to content

How to contribute

Xiaochen Wang edited this page Sep 5, 2017 · 1 revision

1. 点击项目右上角的fork按钮,fork出当前tengine的代码库(https://github.com/alibaba/tengine )。

2. 在本地建立你的tengine代码库,添加上游代码源,以便合并

$ git clone git@github.com:yourname/tengine.git
$ cd tengine
$ git remote add alibaba git://github.com/alibaba/tengine.git

这时你可以看到本地只有一个master分支:

$ git branch
*master

有两个remote代码库:一个是origin,一个是alibaba:

$ git config -l
remote.origin.url=git@github.com:yourname/tengine.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.alibaba.url=git://github.com/alibaba/tengine.git
remote.alibaba.fetch=+refs/heads/*:refs/remotes/alibaba/*

3. 更新获取上游源代码

$ git fetch alibaba

4. 准备最新的代码分支,并修改代码

$ git checkout -b topic alibaba/master

这个时候你就可以进行你的修改了。你可以本地多次commit。

5. push代码到你的代码库,把本地的topic分支push到你远端的topic分支

 $ git push origin topic:topic

6. 提交初始pull request

在网页上https://github.com/yourname/tengine/pull/new/topic 上向alibaba tengine源的master分支发出pull request。pull request时你可以加上一些描述信息。

7. 评论和修改

这时alibaba的tengine成员应该都会收到pull request的信息,可以对其进行评论。 pull request的发出者对意见进行修改,直至有成员同意提交。

8. 为了给上游一个干净的commit日志,我们建议本地把所有的修改都集中到一个commit中,然后提交最终pull request

$ git fetch alibaba
$ git merge alibaba/master
$ git checkout -b final alibaba/master
$ git diff final topic > new.patch
$ patch apply new.patch
$ git commit -a -m "your commit"

在网页上https://github.com/yourname/tengine/pull/new/topic 上向alibaba的tengine源再次发出pull request。pull request时可以加上一些描述信息。

9. tengine成员对第7步的pull request进行合并,至此一个新功能加入。

10. 原作者重新初始化环境, 准备修改新的代码

$ git branch -D topic
$ git branch -D final
$ git fetch alibaba
$ git checkout -b topic alibaba/master