你 fork 了別人的項目之后,他更新了代碼,你 fork 的項目如何與原項目同步更新?
遠程倉庫執行 fork 操作,得到自己的 url
git clone url 到本地
配置遠程分支:git remote add upstream [fork項目的地址]
運行 git remote -v,會出現:
origin https://gitee.com/phpzhi/testPro.git (fetch)
origin https://gitee.com/phpzhi/testPro.git (push)
upstream https://gitee.com/opan/testPro.git (fetch)
upstream https://gitee.com/opan/testPro.git (push)
執行 git fetch upstream 拉取遠程倉庫的代碼
合並拉取的代碼 git merge upstream/master
上傳 git push