You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PhpStorm中Git子模块无法同步更新问题求助

解决PhpStorm中子模块同步及远程分组问题

一、添加远程分组(PhpStorm操作)

  1. 打开Main项目,通过菜单进入 VCS > Git > Manage Remotes
  2. 点击窗口左上角的「+」按钮,选择「New Group」
  3. 给分组设置一个名称(比如和Test项目一致的命名,例如Submodule Remotes)
  4. 选中列表中已有的Submodule远程仓库,拖动到新建的分组内,点击「OK」保存配置

二、修复Main项目子模块无法同步的问题

1. 手动更新子模块到最新版本

在Main项目根目录打开终端,执行命令:

git submodule update --remote path/to/Submodule

将path/to/Submodule替换为Submodule在Main项目中的实际路径

2. 提交主项目的子模块引用变更

执行完更新命令后,终端执行:

git status

此时会看到Submodule路径的变更提示,接着提交该变更:

git add path/to/Submodule
git commit -m "Update submodule to latest commit"
git push

3. 配置PhpStorm自动同步子模块

  1. 打开PhpStorm设置(Windows/Linux:File > Settings;Mac:PhpStorm > Settings)
  2. 进入 Version Control > Git 选项页
  3. 勾选「Update submodules when updating project」,点击「OK」保存
  4. 后续点击Update Project按钮时,PhpStorm会自动同步子模块的最新变更

内容的提问来源于stack exchange,提问作者Palocay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 16:39:46