Fork后,如何在Gitlab和Github下如何同步源的新更新

例子

问题

我在本身的vekko/RuoYi库改啊改,某一天源库y_project/RuoYi更新了,我怎么同步源库过来?

一、配置上游项目地址

进入本身本地库中经过git remote -v 查看源信息
G:\vekko_cc_projects\RuoYi>git remote -v
origin  https://gitee.com/vekko/RuoYi.git (fetch)
origin  https://gitee.com/vekko/RuoYi.git (push)
fetch 和push 都是本身的源,全部咱们要添加repo的源

添加上游repo源git

G:\vekko_cc_projects\RuoYi>git remote add upstream https://gitee.com/y_project/RuoYi.git

注:删除为git remote remove upstreamsegmentfault

而后再看一下源信息,能够看到上游源已经添加进来了fetch

G:\vekko_cc_projects\RuoYi>git remote -v
origin  https://gitee.com/vekko/RuoYi.git (fetch)
origin  https://gitee.com/vekko/RuoYi.git (push)
upstream        https://gitee.com/y_project/RuoYi.git (fetch)
upstream        https://gitee.com/y_project/RuoYi.git (push)

二、获取上游源项目更新。使用fetch命令,fetch以后会被存储到本地一个分支。

G:\vekko_cc_projects\RuoYi>git fetch upstream
From https://gitee.com/y_project/RuoYi
* [new branch]        master     -> upstream/master

三、合并到本地分支。切换到 master 分支,合并 upstream/master 分支。

G:\vekko_cc_projects\RuoYi>git merge upstream/master
Already up to date.

四、提交推送。根据本身状况提交推送本身项目的代码。

git push origin master
邀请你一块儿读 Redis
相关文章
相关标签/搜索