栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Git更新fork的项目到最新版本

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Git更新fork的项目到最新版本

hutool 的项目为例

# 1、查看远程的版本库地址
$ git remote -v
origin https://github.com/xkcoding/hutool.git (fetch) 
origin https://github.com/xkcoding/hutool.git (push)


# 2、添加原项目 git 地址到本地版本库
$ git remote add upstream https://github.com/looly/hutool.git


# 3、检查版本库是否添加成功
$ git remote -v
origin  https://github.com/xkcoding/hutool.git (fetch)
origin  https://github.com/xkcoding/hutool.git (push)
upstream        https://github.com/looly/hutool.git (fetch)
upstream        https://github.com/looly/hutool.git (push)


# 4、原项目更新内容同步到本地
$ git fetch upstream


# 5、查看本地分支
$ git branch -a 
* v4-master 
remotes/origin/HEAD -> origin/v4-master 
remotes/origin/v4-dev 
remotes/origin/v4-master 
remotes/upstream/v4-dev 
remotes/upstream/v4-master


# 6、同步更新内容到本地对应分支
$ git merge upstream/v4-master


# 7、提交更新内容到 fork 地址
git push

参考文档
git 如何更新 fork 的项目到原项目的最新版本

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/271413.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号