当前位置: 代码迷 >> 综合 >> soul-网关实战(三)如何使用git更新fork后的项目到原项目的最新版本
  详细解决方案

soul-网关实战(三)如何使用git更新fork后的项目到原项目的最新版本

热度:79   发布时间:2023-11-13 11:01:13.0

soul-网关实战(三)如何使用git更新fork后的项目到原项目的最新版本

介于最近把soul分享之后,有一些小伙伴反馈,在 github 上 fork 了一个项目之后,不知道如何使自己 fork
的项目和原先作者的项目分支保持同步,我这里就稍微总结示范一下如何使 fork 的项目与原项目分支保持同步,为soul为例。

  1. 查看本地版本库地址
$ git remote -v
origin  git@github.com:jcmob-afj/soul.git (fetch)
origin  git@github.com:jcmob-afj/soul.git (push)
  1. 添加原项目 git 地址到本地版本库
$ git remote add upstream https://github.com/dromara/soul.git
  1. 检查版本库是否添加成功
$ git remote -v
origin  git@github.com:jcmob-afj/soul.git (fetch)
origin  git@github.com:jcmob-afj/soul.git (push)
upstream        https://github.com/dromara/soul.git (fetch)
upstream        https://github.com/dromara/soul.git (push)
  1. 原项目更新内容同步到本地
$ git fetch upstream
remote: Enumerating objects: 78, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 78 (delta 20), reused 56 (delta 18), pack-reused 0
Unpacking objects: 100% (78/78), 21.59 KiB | 134.00 KiB/s, done.
From https://github.com/dromara/soul* [new branch]        1.0.1-release   -> upstream/1.0.1-release* [new branch]        1.0.2-RELEASE   -> upstream/1.0.2-RELEASE* [new branch]        1.0.3-RELEASE   -> upstream/1.0.3-RELEASE* [new branch]        1.0.4-RELEASE   -> upstream/1.0.4-RELEASE* [new branch]        1.0.5-RELEASE   -> upstream/1.0.5-RELEASE* [new branch]        2.0.0-RELEASE   -> upstream/2.0.0-RELEASE* [new branch]        2.0.1-RELEASE   -> upstream/2.0.1-RELEASE* [new branch]        2.1.0-RELEASE   -> upstream/2.1.0-RELEASE* [new branch]        2.1.2-RELEASE   -> upstream/2.1.2-RELEASE* [new branch]        2.2.0           -> upstream/2.2.0* [new branch]        2.2.1           -> upstream/2.2.1* [new branch]        3.0.0           -> upstream/3.0.0* [new branch]        dev             -> upstream/devcbdcf699..ce242e0b  master          -> upstream/master* [new branch]        permission      -> upstream/permission* [new branch]        register-center -> upstream/register-center
  1. 合并更新内容到本地对应分支
$ git merge upstream/master
Updating cbdcf699..ce242e0b
Fast-forwardREADME.md                                          |  22 +---README_CN.md                                       |  22 +---pom.xml                                            |   8 --soul-admin/pom.xml                                 |   5 -.../soul/admin/controller/ResourceController.java  |   4 +-.../listener/nacos/NacosDataChangedListener.java   |  35 ++---.../admin/service/impl/ResourceServiceImpl.java    |   2 +-.../admin/controller/PermissionControllerTest.java |  76 +++++++++++.../soul/admin/service/PermissionServiceTest.java  | 141 +++++++++++++++++++++.../org/dromara/soul/admin/utils/JwtUtilsTest.java |  65 ++++++++++.../soul/admin/utils/ThreadLocalUtilTest.java      |  15 ++-.../dromara/soul/common/enums/ParamTypeEnum.java   |   8 +-.../condition/strategy/AbstractMatchStrategy.java  |   3 +.../handler/RateLimiterPluginDataHandler.java      |  22 ++--.../handler/SoulReactiveRedisTemplate.java         |  58 +++++++++.../handler/SoulReactiveScriptExecutor.java        |  73 +++++++++++soul-plugin/soul-plugin-tars/pom.xml               |  14 +-.../dromara/soul/plugin/tars/TarsPluginTest.java   |  10 +-.../tars/cache/ApplicationConfigCacheTest.java     |  11 +-.../subscriber/TarsMetaDataSubscriberTest.java     |   3 +-.../SoulSpringCloudClientConfiguration.java        |   6 +-21 files changed, 488 insertions(+), 115 deletions(-)create mode 100644 soul-admin/src/test/java/org/dromara/soul/admin/controller/PermissionControllerTest.javacreate mode 100644 soul-admin/src/test/java/org/dromara/soul/admin/service/PermissionServiceTest.javacreate mode 100644 soul-admin/src/test/java/org/dromara/soul/admin/utils/JwtUtilsTest.javacreate mode 100644 soul-plugin/soul-plugin-ratelimiter/src/main/java/org/dromara/soul/plugin/ratelimiter/handler/SoulReactiveRedisTemplate.javacreate mode 100644 soul-plugin/soul-plugin-ratelimiter/src/main/java/org/dromara/soul/plugin/ratelimiter/handler/SoulReactiveScriptExecutor.java
  1. 提交更新内容到 fork 地址
$ git push

到这里大概就完了,希望对你有所帮助~

  相关解决方案