GitHub Fork无法完全更新:子模块拆分后同步异常求助
解决子模块拆分后的未暂存状态问题
- 先同步上游的子模块配置并拉取最新内容:
git submodule sync --recursive git submodule update --init --recursive
这会让本地仓库读取上游更新后的子模块配置,初始化新增的子模块,同时把旧子模块更新到适配拆分的版本。
- 如果旧子模块还在未暂存区,进入子模块目录重置到指定版本:
cd path/to/old-submodule git reset --hard cd ../
回到主仓库后重新添加子模块:
git add path/to/old-submodule
- 最后验证状态并提交:
git status git commit -m "同步上游拆分后的子模块配置"
- 要是以上步骤没用,先清除子模块的缓存再重试:
git rm --cached path/to/old-submodule git submodule sync --recursive
内容的提问来源于stack exchange,提问作者Igor
相关产品推荐
相关产品推荐

