PhpStorm中Git子模块无法同步更新问题求助
解决PhpStorm中子模块同步及远程分组问题
一、添加远程分组(PhpStorm操作)
- 打开Main项目,通过菜单进入
VCS > Git > Manage Remotes - 点击窗口左上角的「+」按钮,选择「New Group」
- 给分组设置一个名称(比如和Test项目一致的命名,例如
Submodule Remotes) - 选中列表中已有的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自动同步子模块
- 打开PhpStorm设置(Windows/Linux:
File > Settings;Mac:PhpStorm > Settings) - 进入
Version Control > Git选项页 - 勾选「Update submodules when updating project」,点击「OK」保存
- 后续点击Update Project按钮时,PhpStorm会自动同步子模块的最新变更
内容的提问来源于stack exchange,提问作者Palocay
相关产品推荐
相关产品推荐

