FORK了别人的项目之后如何保持同步更新


你 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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM