- 办法1:网页操作
github fork的库,如何同步源库的更新_柳鲲鹏的博客-CSDN博客
办法2:手动法
进入自己的本机库目录:
# 查看远程状态
$ git remote -v
origin https://outh2:ghp_kY@github.com/quantum6/jdk (fetch)
origin https://outh2:ghp_kY@github.com/quantum6/jdk (push)
# 给 fork 添加源库的clone地址
$ git remote add upstream 源库的clone地址
$ git remote -v
origin https://outh2:ghp_kY@github.com/quantum6/jdk (fetch)
origin https://outh2:ghp_kY@github.com/quantum6/jdk (push)
upstream https://github.com/openjdk/jdk (fetch)
upstream https://github.com/openjdk/jdk (push)
# 更新与合并
$ git pull https://github.com/quantum6/jdk quantum6
$ git fetch upstream
$ git merge upstream/master
$ git push origin master