Git/Github:替换分叉存储库的子模块 分叉的项目结构

问题描述

我想要的

我有一个 open source parent repository,我想创建一个 fork 来使用它,这个存储库由 3 个子模块和一些配置文件组成。我想要的是用我自己的实现(私有存储库)替换子模块(saleor-storefront)之一,并且我希望能够使用上游存储库所做的更改来更新其他子模块和文件。

我应该从 .gitmodules 文件中更改我想要替换的模块的路径,还是有其他我不知道的更改?

分叉的项目结构

saleor-platform
├── ./.gitmodules
├── ./common.env
├── ./docker-compose.yml
├── ./saleor
├── ./saleor-dashboard
└── ./saleor-storefront  -> Submodule to be replaced with my own implementation

.gitmodules

[submodule "saleor"]
    path = saleor
    url = https://github.com/mirumee/saleor.git
[submodule "saleor-storefront"]
    path = saleor-storefront
    url = https://github.com/mirumee/saleor-storefront.git
[submodule "saleor-dashboard"]
    path = saleor-dashboard
    url = https://github.com/mirumee/saleor-dashboard.git

解决方法

Git 2.25 command git submodule set-url 应该有助于更新/替换您的一个子模块的 URL:

git submodule set-url -- saleor-storefront https://github.com/<me>/saleor-storefront

这样,您就不会错过修改子模块 URL 时涉及的任何“其他更改”。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...