Git协作工作流¶
这篇文档是关于如何通过GitHub参与DevStream开发的流程。
第一步 - Fork 仓库¶
- 打开项目仓库: https://github.com/devstream-io/devstream ;
- 点击
Fork
按钮,从DevStream创建一个fork。
第二步 - Clone 仓库¶
- 定义一些基础的环境变量
请根据你的实际情况来设置值。
Bash
export WORKING_PATH="~/gocode"
export USER="daniel-hutao"
export PROJECT="devstream"
export ORG="devstream-io"
-
Clone 仓库到你本地
Bashmkdir -p ${WORKING_PATH} cd ${WORKING_PATH} # You can also use the url: git@github.com:${USER}/${PROJECT}.git # if your ssh configuration is proper git clone https://github.com/${USER}/${PROJECT}.git cd ${PROJECT} git remote add upstream https://github.com/${ORG}/${PROJECT}.git # Never push to upstream locally git remote set-url --push upstream no_push
-
确认你的远程设置是正确的
执行git remote -v
这个命令,你将看到如下输出:
Bash
origin git@github.com:daniel-hutao/devstream.git (fetch)
origin git@github.com:daniel-hutao/devstream.git (push)
upstream https://github.com/devstream-io/devstream (fetch)
upstream no_push (push)
第三步 - 分支代码保持同步更新¶
你经常需要更新你的本地代码,以便与上游保持同步。
第四步 - 编码¶
首先,你需要拉一个新的分支,名字根据你自己的喜好而定。
然后开始编码吧。
第五步 - 提交&推送¶
然后你就可以在GitHub上创建一个pr
。
附录¶
也欢迎阅读我们的博客-如何参与开源项目 - 细说 GitHub 上的 PR 全过程,了解更多 GitHub 协作流程,如解决冲突等。