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"
复制代码
相关推荐
Unity粉末状在校生5 小时前
Git解决fatal: Could not read from remote repository.的问题
git
少年攻城狮6 小时前
Obsidian系列---【如何使用obsidian同步到git?】
git
do better myself8 小时前
网站源码如何部署和加入GIT仓库的
git
爱学英语的程序员11 小时前
Git 提交 LF will be replaced by CRLF the next time Git touches it 报错
git
qq_3391911411 小时前
服务器git pull每次都要输入密码,linux 设置git登录,linux设置git只输入一次账户密码
git
一颗小行星!18 小时前
快速理解 Git submodule
git
A-Jie-Y20 小时前
Git基础-核心概念与常用命令
git
夜珀20 小时前
Git基础修炼手册:在AtomGit上玩转版本控制
git
golang学习记21 小时前
Zed IDE官宣新招:Git Graph 正式支持!
ide·git
要记得喝水21 小时前
适用于 Git Bash 的脚本,批量提交和推送多个仓库的修改
git·elasticsearch·bash