随笔 - 502  文章 - 1 评论 - 6 阅读 - 37万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

背景: 在Gitee看到某个非常棒的项目, Fork到自己仓库, 同时git clone 自己仓库,用来自己开发,  后来初始Fork的项目更新了, 于是想更新初始Fork的最新代码和已改的代码整合起来..

 

首先在本地查看remote源, 可以看见初始本地仓库副本的2个源

PS E:\workspace_idea\RuoYi-Vue> git remote -v
origin  https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
origin  https://gitee.com/easonstudy/RuoYi-Vue.git (push)

此时新增原始Fork项目源, 然后再查看remote源

PS E:\workspace_idea\RuoYi-Vue> git remote add upstream https://gitee.com/y_project/RuoYi-Vue.git
PS E:\workspace_idea\RuoYi-Vue> git remote -v
origin https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
origin https://gitee.com/easonstudy/RuoYi-Vue.git (push)
upstream https://gitee.com/y_project/RuoYi-Vue.git (fetch)
upstream https://gitee.com/y_project/RuoYi-Vue.git (push)

然后拉取upstream(Fork)代码,本地会有upstream/master分支

PS E:\workspace_idea\RuoYi-Vue> git fetch upstream
From https://gitee.com/y_project/RuoYi-Vue
* [new branch] master -> upstream/master

切换到自己仓库master分支,并合并upstream/master

PS E:\workspace_idea\RuoYi-Vue> git branch
* master
PS E:\workspace_idea\RuoYi-Vue> git checkout master
Already on 'master'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
PS E:\workspace_idea\RuoYi-Vue> git merge upstream/master
Already up to date.

更新完后实现自己仓库和Fork项目在自己本地了

 

posted on   1161588342  阅读(2017)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2019-04-23 TensorFlow Minist零基础弄明白 反向传播算法
2019-04-23 TensorFlow Minist零基础弄明白 交叉熵
2018-04-23 Docker dockerfile-maven-plugin 使用
2018-04-23 Docker remote api 开启
2018-04-23 Linux git 关联 github仓库
点击右上角即可分享
微信分享提示