For many git-based projects, submodules are useful in avoiding duplicate work and easing utility library updates.  There are times, however, when a submodule needs to be removed from a project.  Submodules aren't removed with git rm submoduledir, they must be removed in a more tedious, manual fashion.  There are many unclear explanations of how to remove a submodule but I found one on Stack Overflow that's concise, so I thought I'd share it.  The steps are as follows:

  1. Delete the relevant section from the .gitmodules file.  The section would look similar to:

    [submodule "vendor"]
    path = vendor
    url = git://github.com/some-user/some-repo.git
  2. Stage the .gitmodules changes via command line using:git add .gitmodules
  3. Delete the relevant section from .git/config, which will look like:
    [submodule "vendor"]
    url = git://github.com/some-user/some-repo.git
  4. Run git rm --cached path/to/submodule .  Don't include a trailing slash -- that will lead to an error.
  5. Run rm -rf .git/modules/submodule_name
  6. Commit the change:
  7. Delete the now untracked submodule files rm -rf path/to/submodule

Those steps will get you rid of that unwanted submodule.  A lot harder than adding one, eh?

from: http://davidwalsh.name/git-remove-submodule

Remove a Submodule within git的更多相关文章

  1. Remove all your local git branches but keep master

    Sometimes after a sprint, all the remaining branches are just taking up space. Here's a small snippe ...

  2. git submodule 使用

    这个是备忘录,原网页: https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407 http://cncc.bingj.c ...

  3. 转:Git Submodule管理项目子模块

    使用场景 当项目越来越庞大之后,不可避免的要拆分成多个子模块,我们希望各个子模块有独立的版本管理,并且由专门的人去维护,这时候我们就要用到git的submodule功能. 常用命令 git clone ...

  4. Git submodule - 子模块【转】

    子模块 有种情况我们经常会遇到:某个工作中的项目需要包含并使用另一个项目. 也许是第三方库,或者你独立开发的,用于多个父项目的库. 现在问题来了:你想要把它们当做两个独立的项目,同时又想在一个项目中使 ...

  5. [转]使用Git Submodule管理子模块

    本文转自:https://blog.csdn.net/qq_37788558/article/details/78668345 实例代码: 父项目:https://github.com/jjz/pod ...

  6. Git Submodule管理项目子模块

    使用场景 当项目越来越庞大之后,不可避免的要拆分成多个子模块,我们希望各个子模块有独立的版本管理,并且由专门的人去维护,这时候我们就要用到git的submodule功能. 常用命令 git clone ...

  7. 使用Git Submodule管理子模块

    转自:https://segmentfault.com/a/1190000003076028 使用场景 基于公司的项目会越来越多,常常需要提取一个公共的类库提供给多个项目使用,但是这个library怎 ...

  8. Git: fatal: Pathspec is in submodule

    出现是问题: git提交代码是出现fatal: Path 'directory/file' is in submodule 'directory''错误 Removing the directory ...

  9. Git Submodule使用完整教程

    Git Submodule功能刚刚开始学习可能觉得有点怪异,所以本教程把每一步的操作的命令和结果都用代码的形式展现给大家,以便更好的理解. 1.对于公共资源各种程序员的处理方式 每个公司的系统都会有一 ...

随机推荐

  1. NSStream文件流

    1.文件流的使用 NSString *filePath = @"/Users/JHQ0228/Desktop/test.txt"; NSData *data = [@"h ...

  2. day6学python 生成器迭代器+压缩文件

    生成器迭代器+压缩文件 readme的规范 1软件定位,软件的基本功能2运行代码的方法:安装环境,启动命令3简要的使用说明4代码目录结构说明,更详细点可以说明软件的基本原理5常见问题说明 ====== ...

  3. 标准模板库使用参考——vector向量容器

    C++的STL从广义上讲分为algorithm(算法),container(容器)和iterator(迭代器)三类,包含了诸多在计算机科学领域里所常用的基本数据结构和基本算法. 在C++标准库中,ST ...

  4. 单源最短路SPFA算法

    $huaji^{233……}$模板:洛谷 P3371 #include<iostream> #include<algorithm> #include<cstdio> ...

  5. java10:基于时间的版本控制

    功能发布 从Java 10开始,采用了一种新的严格的基于时间的发布模式. 在这个新模型中,Java平台的主要版本(现称为功能版本)将每6个月(3月和9月)发布一次. 功能版本将包含语言功能,JVM功能 ...

  6. Leetcode 25. Reverse Nodes in k-Group 以每组k个结点进行链表反转(链表)

    Leetcode 25. Reverse Nodes in k-Group 以每组k个结点进行链表反转(链表) 题目描述 已知一个链表,每次对k个节点进行反转,最后返回反转后的链表 测试样例 Inpu ...

  7. 【Jquery】jquery刷新页面(局部及全页面刷新)

    下面介绍全页面刷新方法:有时候可能会用到window.location.reload()刷新当前页面.parent.location.reload()刷新父亲对象(用于框架)opener.locati ...

  8. 如何让ie8地址栏下拉框里不显示历史记录和收藏夹

    打开浏览器,点击IE浏览器上方工具——Internet选项——内容——自动完成的设置——地址栏里面的勾勾去掉,浏览历史记录和收藏夹里面的东西就自动没有了

  9. TX2 默认root用户启动

    Jetpack3.1 修改方式 修改1 gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf 修改后: 修改2 gedit /root/.pro ...

  10. 洛谷 P3391【模板】文艺平衡树(Splay)

    题目背景 这是一道经典的Splay模板题--文艺平衡树. 题目描述 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:翻转一个区间,例如原有序序列是5 4 3 2 1, ...