git fork项目更新
2020-07-28 本文已影响0人
星辰fml
介绍
当我们从其他的开源项目中fork了项目到我们自己的仓库后,如果源仓库有更新,我们怎么将更新同步我们自己仓库中已fork项目呢。下面就以incubator-dolphinscheduler项目为例,来进行介绍完整的过程
fork项目到自己仓库
这个在github上可以直接操作,略过。
clone到本地
使用命令git clone将github项目clone到本地计算机某个目录中
git clone https://github.com/zapjone/incubator-dolphinscheduler.git
其速度就取决于网络了。

添加当前fork项目的远程仓库地址

可以通过[git remote -v]查看远程仓库地址和源仓库地址

获取源项目的更新
git fetch upstream

合并到本地master分支
git merge upstream/master

因为我已经merge过了,所以本来就是最新的。
push到github(自己的github)
git push origin master

至此,github上和fork项目就保持一致了。