From 73865908a0a0af08fd38647aec0c7182864cad43 Mon Sep 17 00:00:00 2001 From: brace Date: Mon, 9 Nov 2020 14:26:17 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=AC=AC=E4=B8=89=E9=83=A8=E5=88=86?= =?UTF-8?q?=E2=80=94=E2=80=94=E5=B0=9D=E8=AF=95=E5=8F=82=E4=B8=8E=E5=BC=80?= =?UTF-8?q?=E6=BA=90/=E6=8F=90=E4=BA=A4=E7=AC=AC=E4=B8=80=E4=B8=AA=20Pull?= =?UTF-8?q?=20Request.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\344\270\200\344\270\252 Pull Request.md" | 65 ++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git "a/\347\254\254\344\270\211\351\203\250\345\210\206\342\200\224\342\200\224\345\260\235\350\257\225\345\217\202\344\270\216\345\274\200\346\272\220/\346\217\220\344\272\244\347\254\254\344\270\200\344\270\252 Pull Request.md" "b/\347\254\254\344\270\211\351\203\250\345\210\206\342\200\224\342\200\224\345\260\235\350\257\225\345\217\202\344\270\216\345\274\200\346\272\220/\346\217\220\344\272\244\347\254\254\344\270\200\344\270\252 Pull Request.md" index 1175291..a980c83 100644 --- "a/\347\254\254\344\270\211\351\203\250\345\210\206\342\200\224\342\200\224\345\260\235\350\257\225\345\217\202\344\270\216\345\274\200\346\272\220/\346\217\220\344\272\244\347\254\254\344\270\200\344\270\252 Pull Request.md" +++ "b/\347\254\254\344\270\211\351\203\250\345\210\206\342\200\224\342\200\224\345\260\235\350\257\225\345\217\202\344\270\216\345\274\200\346\272\220/\346\217\220\344\272\244\347\254\254\344\270\200\344\270\252 Pull Request.md" @@ -1,3 +1,62 @@ -### 什么是 Pull Request -### 提交 Pull Request 的步骤 -### Pull Request 案例(有价值和无价值) \ No newline at end of file +### 尝试参与开源:提交第一个 Pull Request + +#### 什么是 Pull Request + +​ 这个是由 GitHub 提出的概念。根据 GitHub 的官方文档,Pull Request 是一种通知机制,它可以告知仓库的其他开发者,你推送了一个仓库新分支。 通过Pull Request ,你可以和仓库的协作者一起讨论和审查提交的代码,审查通过后,就可以提交到仓库的主分支中。 + +​ Pull Request 本质上是一种协同工作的机制,可以进行基于网络的多人提交,审核机制,审核通过后,就可以合并到主分支中。 + +#### 提交 Pull Request 的步骤 + +​ 第一步,你需要 fork 别人的仓库。也就是复制别人的仓库到你自己的仓库中。 + +​ 第二步,在你自己的仓库上,修改然后提交之后,在网页端点击"New pull request"按钮。 + +​ 在接下来的网页上有 base 仓库和 head 仓库,其中 base 是你想要提交的仓库,head 分支是你已经提交变更的仓库。 + +​ 第三步,在提交中,描述提交本地提交的说明。 + + +#### 实际操作一下 + +1. 在 GitHub 上建立两个帐号A和B。 + +1. 使用 A 帐号,创建项目 pull_request_demo + +1. 在本地提交 README.md + ``` + echo "# " >> README.md + git init + git add README.md + git commit -m "first commit" + git branch -M main + git remote add origin https://github.com/A/pull_request_demo.git + git push -u origin main + ``` + +1. 使用 B 帐号登录 GitHub,然后fork 该项目。 + +1. 下载项目到本地 + + ``` + git clone https://github.com/B/pull_request_demo + echo "# add form B" >> README.md + git add README.md + git commit -m "modify " + git push + ``` + +1. 使用 B 帐号登录 GitHub,进入 pull_request_demo 仓库,点击 Pull request 链接。 + +1. 使用 B 帐号登录 GitHub,进入 pull_request_demo 仓库,点击 Pull request 链接。 + +1. 选择 base 和 head 仓库。点击 "New pull request"按钮。 + +1. 填写提交说明后,"Create pull request" + +1. 使用 A 帐号登录 GitHub,进行 pull_request_demo 项目。 + +1. 可以看到 Pull request 中有新的数据 + +1. 点击 Confirm merge,完成合并。 + -- Gitee