GitHub 的 Pull Request 是指什么意思?
来源:互联网 发布:js invoke 编辑:程序博客网 时间:2024/06/08 20:07
作者:知乎用户
链接:https://www.zhihu.com/question/21682976/answer/79489643
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
<img src="https://pic3.zhimg.com/6aaed35908e74de871fcbed7c5affb0e_b.png" data-rawwidth="2010" data-rawheight="506" class="origin_image zh-lightbox-thumb" width="2010" data-original="https://pic3.zhimg.com/6aaed35908e74de871fcbed7c5affb0e_r.png">
2. 在你自己的机器上 git clone 这个仓库,切换分支(也可以在 master 下),做一些修改。
3. 完成修改之后,回到 test-pr 分支,点击旁边绿色的 Compare & pull request 按钮
<img src="https://pic2.zhimg.com/3e1ac7f58774a79a5dd6bf8e852e4199_b.png" data-rawwidth="2010" data-rawheight="476" class="origin_image zh-lightbox-thumb" width="2010" data-original="https://pic2.zhimg.com/3e1ac7f58774a79a5dd6bf8e852e4199_r.png">4. 添加一些注释信息,确认提交4. 添加一些注释信息,确认提交
<img src="https://pic3.zhimg.com/f5ed68dfe4d60fe90e2fb22ec1933006_b.png" data-rawwidth="1658" data-rawheight="1294" class="origin_image zh-lightbox-thumb" width="1658" data-original="https://pic3.zhimg.com/f5ed68dfe4d60fe90e2fb22ec1933006_r.png">5. 仓库作者看到,你提的确实是对的,就会 merge,合并到他的项目中
Fork A Repo - User Documentation
Using pull requests
Creating a pull request
链接:https://www.zhihu.com/question/21682976/answer/79489643
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
我尝试用类比的方法来解释一下 pull reqeust。想想我们中学考试,老师改卷的场景吧。你做的试卷就像仓库,你的试卷肯定会有很多错误,就相当于程序里的 bug。老师把你的试卷拿过来,相当于先 fork。在你的卷子上做一些修改批注,相当于 git commit。最后把改好的试卷给你,相当于发 pull request,你拿到试卷重新改正错误,相当于 merge。
当你想更正别人仓库里的错误时,要走一个流程:- 先 fork 别人的仓库,相当于拷贝一份,相信我,不会有人直接让你改修原仓库的
- clone 到本地分支,做一些 bug fix
- 发起 pull request 给原仓库,让他看到你修改的 bug
- 原仓库 review 这个 bug,如果是正确的话,就会 merge 到他自己的项目中
至此,整个 pull request 的过程就结束了。
理解了 pull request 的含义和流程,具体操作也就简单了。以 Github 排名最高的 https://github.com/twbs/bootstrap 为例说明。
1. 先点击 fork 仓库,项目现在就在你的账号下了
<img src="https://pic3.zhimg.com/6aaed35908e74de871fcbed7c5affb0e_b.png" data-rawwidth="2010" data-rawheight="506" class="origin_image zh-lightbox-thumb" width="2010" data-original="https://pic3.zhimg.com/6aaed35908e74de871fcbed7c5affb0e_r.png">
2. 在你自己的机器上 git clone 这个仓库,切换分支(也可以在 master 下),做一些修改。
~ git clone https://github.com/beepony/bootstrap.git~ cd bootstrap~ git checkout -b test-pr~ git add . && git commit -m "test-pr"~ git push origin test-pr
<img src="https://pic2.zhimg.com/3e1ac7f58774a79a5dd6bf8e852e4199_b.png" data-rawwidth="2010" data-rawheight="476" class="origin_image zh-lightbox-thumb" width="2010" data-original="https://pic2.zhimg.com/3e1ac7f58774a79a5dd6bf8e852e4199_r.png">4. 添加一些注释信息,确认提交4. 添加一些注释信息,确认提交
<img src="https://pic3.zhimg.com/f5ed68dfe4d60fe90e2fb22ec1933006_b.png" data-rawwidth="1658" data-rawheight="1294" class="origin_image zh-lightbox-thumb" width="1658" data-original="https://pic3.zhimg.com/f5ed68dfe4d60fe90e2fb22ec1933006_r.png">5. 仓库作者看到,你提的确实是对的,就会 merge,合并到他的项目中
5. 仓库作者看到,你提的确实是对的,就会 merge,合并到他的项目中
以上就是 pull reqesut 的整个流程,希望对你有帮助~
参考文档:Fork A Repo - User Documentation
Using pull requests
Creating a pull request
阅读全文
0 0
- GitHub 的 Pull Request 是指什么意思?
- GitHub 的 Pull Request 是指什么意思?
- github的pull request
- GitHub的Pull Request
- 关于Github的Pull Request的详解
- github Pull请求(Pull request)
- github 上的pull request总结
- 秒懂github的pull request
- github之Pull Request
- github 中的pull request
- github中的pull request
- Github 之 Pull Request
- github pull request
- github pull request
- GitHub:pull request
- Github pull request流程
- github pull request
- GitHub——Pull Request
- django启动后自动调用程序?
- Mydsql中字符截取SubString
- 经典算法之查找重复元素
- 群论学习之A5群为什么是单群
- 张正友标定---非常重要的基础
- GitHub 的 Pull Request 是指什么意思?
- asp.net core MVC 过滤器之ExceptionFilter过滤器(一)
- 双目标定---非常重要的基础
- 关于 异常 的一些总结(自定义异常确实有用啊)
- Responsive Design with Bootstrap
- 关于postgresql自定义函数和触发器的一些问题
- ACM暑期训练总结
- 闭包的用途
- redis解决购物车的问题