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"
复制代码
相关推荐
vibecoding日记1 天前
为什么我就想要「线性历史 + Signed Commits」,GitHub 却把我当猴耍 🤬🎙️
git·编程工具
程序员小崔日记1 天前
如何将代码轻松上传到 Gitee?Git 使用全攻略!
git·gitee·上传
Bigger2 天前
为什么你的 Git 提交需要签名?—— Git Commit Signing 完全指南
git·开源·github
DianSan_ERP3 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
红豆子不相思3 天前
Tomcat 环境搭建与集群实战
服务器·git·tomcat
杰哥技术分享3 天前
Git 仓库迁移技术文档:从 CODING.net 迁移至腾讯云 CNB
git
梅孔立3 天前
Ansible 100 台服务器一键管控实战 进阶版
服务器·git·ansible
qq_426003964 天前
git切换当前分支到远程分支
git
ON10N4 天前
100% 纯 Vibe Coding,我是怎么用 AI 撸出一个 VS Code 插件的
git·ai编程·visual studio code