# 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"