git删除submodule

复制代码
# Git 子模块删除教程(以 ./prome 为例)

本文说明如何彻底删除 Git 子模块,以避免残留配置导致后续仓库异常。示例子模块路径为 `./prome`。

---

## 删除步骤

### 1. 删除 `.gitmodules` 中的子模块配置
```bash
git config -f .gitmodules --remove-section submodule.prome 2>/dev/null
git add .gitmodules

2. 删除 .git/config 中对应的配置

复制代码
git config --remove-section submodule.prome 2>/dev/null

3. 删除 Git 存储的子模块仓库目录

复制代码
rm -rf .git/modules/prome

4. 删除工作区中的子模块目录

复制代码
git rm -f prome

5. 提交删除记录

复制代码
git commit -m "Remove submodule prome"

完整命令汇总

复制代码
git config -f .gitmodules --remove-section submodule.prome 2>/dev/null
git add .gitmodules
git config --remove-section submodule.prome 2>/dev/null
rm -rf .git/modules/prome
git rm -f prome
git commit -m "Remove submodule prome"
复制代码
相关推荐
大志哥1233 小时前
idea+git插件+云备份实现项目新分支新建维护
git
恋喵大鲤鱼3 小时前
git merge
git·git merge
码客日记4 小时前
Spring Boot 配置文件敏感信息加密(Jasypt 企业级完整方案)
java·spring boot·git
_codemonster4 小时前
Codex 核心进阶玩法(技能/MCP/派生/分叉/Git/钩子/子智能体)
git
逻极4 小时前
Git 从入门到精通:版本控制协作实战指南
git·github·分支管理·版本控制
恋喵大鲤鱼4 小时前
git clean
git·git clean
Patrick_Wilson5 小时前
为省一次回归测试,该不该把多个改动堆进一条分支?
git·ci/cd·架构
恋喵大鲤鱼5 小时前
git blame
git·git blame
yeflx5 小时前
Git操作
git
恋喵大鲤鱼5 小时前
git pull
git·git pull