Skip to main content
 首页 » 编程设计

Github上面拉取别人提交的PR

2022年07月19日174落叶无声

在github上面协同开发,避免不了拉取别的同学的PR,那么如何拉取呢?

1、首先我们看下upstream

liz@liz-PC:~/jimeng/handle-api$ git remote -v 
origin    https://github.com/lz-2019/handle-api.git (fetch) 
origin    https://github.com/lz-2019/handle-api.git (push) 
remote    https://github.com/beego/handle-api.git (fetch) 
remote    https://github.com/beego/handle-api.git (push)
我们可以看到remote是源代码的指向

2、然后看到这个PR的ID是 213

超时信息错误 #213

3、使用fetch PR 拉取

liz@liz-PC:~/jimeng/handle-api$ git fetch remote  pull/213/head:jm5594 
remote: Enumerating objects: 64, done. 
remote: Counting objects: 100% (64/64), done. 
remote: Compressing objects: 100% (46/46), done. 
remote: Total 64 (delta 17), reused 44 (delta 12), pack-reused 0 
展开对象中: 100% (64/64), 完成. 
来自 https://github.com/beego/handle-api 
 * [新引用]            refs/pull/213/head -> jm5594
 
然后切到拉取的分支 
git checkout jm5594

本文参考链接:https://www.cnblogs.com/ricklz/p/11833784.html