Git笔记 (12)

打开https://github.com/Data4Democracy/github-playground,点击Fork,等待副本仓库生成,复制下载url,使用git clone到本地,然后在master分支下创建PR_practice分支,然后使用vi hello_test.py对文件进行修改,在后面添加一句print("PR practice, thanks"),然后Ese:wq保存后,再进行提交修改,最后push到origin/PR_practice分支就可以了,详细过程如下:

$ git clone git@github.com:FangYang970206/github-playground.git Cloning into 'github-playground'... remote: Counting objects: 230, done. remote: Compressing objects: 100% (7/7), done. remote: Total 230 (delta 2), reused 4 (delta 1), pack-reused 221 Receiving objects: 100% (230/230), 307.80 KiB | 324.00 KiB/s, done. Resolving deltas: 100% (85/85), done. $ cd github-playground/ $ git checkout -b PR_practice Switched to a new branch 'PR_practice' $ vi hello_test.py $ git add hello_test.py $ git commit -m "add PR practice" [PR_practice a874bdf] add PR practice 1 file changed, 1 insertion(+) $ git push origin PR_practice Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 309 bytes | 309.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local object. To github.com:FangYang970206/github-playground.git * [new branch] PR_practice -> PR_practice

我们再进入我们感兴趣的仓库地址,就会发现如下页面

image_1cll1urqtmlk1a1mqkm1vlq1ctckv.png-117.5kB


我们点击旁边的compare&pull request或者直接点击New pull request,写一下标题和commit,然后creat pull request。

image_1cll2fv7r1ncok5018dm176fretlc.png-129.2kB


最后等待仓库拥有者审核,对这个pull request进行讨论,看是否要进行再修改等等。另外,每一个pull request都可以看files changed,可以看到有哪些行添加进去了,有哪些删除了,很是方便。

以上,就是一个pull request的流程,记得动手操作一遍。

8. 参考

最后,希望这篇文章能对看的朋友有所帮助,欢迎给这篇文章来个star。本文大量参考了Pro Git,建议读者可以去读一读这本git官网推荐的书籍。git-github-intro对git有一个不错大致简介。learngitbranching是一个非常不错的动手学习网站,推荐去动手学习,更多资源可以去参考trygit里面的内容。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wppgpw.html