You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by mj...@apache.org on 2018/11/20 02:36:24 UTC

[incubator-dubbo-ops.wiki] branch master updated: Created 如何在Github上贡献代码 (markdown)

This is an automated email from the ASF dual-hosted git repository.

mjk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.wiki.git


The following commit(s) were added to refs/heads/master by this push:
     new 2957c74  Created 如何在Github上贡献代码 (markdown)
2957c74 is described below

commit 2957c741e0b9e638504c9a1c60f4c4840a68544b
Author: 马金凯 <ma...@vip.qq.com>
AuthorDate: Tue Nov 20 10:36:22 2018 +0800

    Created 如何在Github上贡献代码 (markdown)
---
 ...264\241\347\214\256\344\273\243\347\240\201.md" | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git "a/\345\246\202\344\275\225\345\234\250Github\344\270\212\350\264\241\347\214\256\344\273\243\347\240\201.md" "b/\345\246\202\344\275\225\345\234\250Github\344\270\212\350\264\241\347\214\256\344\273\243\347\240\201.md"
new file mode 100644
index 0000000..f47d5f2
--- /dev/null
+++ "b/\345\246\202\344\275\225\345\234\250Github\344\270\212\350\264\241\347\214\256\344\273\243\347\240\201.md"
@@ -0,0 +1,67 @@
+# 操作顺序
+1. 找到心仪的开源项目,Fork它,Star它
+2. 根据自己的项目地址Clone到本地
+3. 将被Fork的项目添加为upstream,用以跟踪其所有修改
+4. 创建一个新的分支(补丁/特性都可以,名称跟你要开发的内容相关)
+5. 编写你的代码
+6. 提交N次代码(如果想把这N次提交合并成一次,显得漂亮一些的话,可以执行提交合并[1])
+7. 将创建的分支推送到origin
+8. 在Github上面发起Pull Request请求等待合并
+9. 如果代码被合并了,可以删除自己的分支
+10. 拉取upstream的最新提交
+11. 创建新的分支
+12. 将新分支rebase到upstream的最新提交点
+13. 重复5~12即可
+
+#### [1] 提交合并
+我们在本地开发时,可以随时去提交写好的代码,但是这样会导致提交历史比较多,推送到远端或者发起Pull Request显得比较杂乱,这时我们就可以将几次提交或者全部提交合并成一次提交,执行顺序如下:
+* 切换到需要合并提交的分支
+* 输入git rebase -i HEAD~N(N=你想合并的最后几次提交),看到如下输出:
+```shell
+pick 708fa0a commit message A
+pick 8baaa26 commit message B
+pick dba177a commit message C
+
+# Rebase 2d2fb07..bfa62a9 onto 2d2fb07 (3 command(s))
+#
+# Commands:
+# p, pick = use commit
+# r, reword = use commit, but edit the commit message
+# e, edit = use commit, but stop for amending
+# s, squash = use commit, but meld into previous commit
+# f, fixup = like "squash", but discard this commit's log message
+# x, exec = run command (the rest of the line) using shell
+# d, drop = remove commit
+#
+# These lines can be re-ordered; they are executed from top to bottom.
+#
+# If you remove a line here THAT COMMIT WILL BE LOST.
+#
+# However, if you remove everything, the rebase will be aborted.
+#
+# Note that empty commits are commented out
+```
+
+* 根据Commands注释修改成你想要的效果,例如:
+```shell
+pick 708fa0a commit message A
+squash 8baaa26 commit message B
+squash dba177a commit message C
+
+# ...
+```
+* 输入:wq保存退出,会出现如下提交信息:
+```shell
+# This is a combination of 3 commits.
+# The first commit's message is:
+commit message A
+
+# This is the 2nd commit message:
+commit message B
+
+# This is the 3rd commit message:
+commit message C
+```
+* 根据实际情况修改提交信息
+* 再次输入:wq就会看到合并完毕的提示信息
+* 这时候Rebase合并就成功了,并且三次提交也合并在一起成为一次提交
\ No newline at end of file