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. struts2配置文件的解释

    1 <?xml version="1.0" encoding="GB2312"?>  <!DOCTYPE struts PUBLIC &quo ...

  2. selenium面试题

    selenium中如何判断元素是否存在? selenium中没有提供原生的方法判断元素是否存在,一般我们可以通过定位元素+异常捕获的方式判断. # 判断元素是否存在 try: dr.find_elem ...

  3. IO相关3(string流)

    sstream 头文件定义了三个类型来支持内存 IO,这些类型可以向 string 写入数据,从 string 读取数据,就像 string 是一个 IO 流一样. istringstream 从 s ...

  4. 决策树--Python

    决策树 实验集数据: #coding:utf8 #关键词:决策树(desision tree).特征选择.信息增益(information gain).香农熵.熵(entropy).经验熵(H(D)) ...

  5. 老男孩Day9作业:高级FTP

    一.作业需求 1. 用户加密认证(已完成) 2. 多用户同时登陆(已完成) 3. 每个用户有自己的家目录且只能访问自己的家目录(已完成) 4. 对用户进行磁盘配额.不同用户配额可不同(已完成) 5.  ...

  6. webpack(二)解析es6并打包

    一.前言 ECMAScript 6(ES6)的发展速度非常之快,但现代浏览器对ES6新特性支持度不高,所以要想在浏览器中直接使用ES6的新特性就得借助别的工具来实现.Babel是一个广泛使用的转码器, ...

  7. C# 使用List<T> 内存溢出

    class Program    {        static void Main(string[] args)        {            var all = new List< ...

  8. (IDEA) VCS-->Import Into Version Control没有Share Project(Subversion)这个选项。

    在VCS-->Import Into Version Control,会发现只有Import Into Subversion选项,并没有Share Project(Subversion)这个选项 ...

  9. yalinqo 的使用...

    from($this->getInfo())->where('$v["is_enable"]==1')->where(function (&$v) use ...

  10. copy模拟

    1.copy是浅复制,只复制一层:而deepcopy是所有层都复制,适用于lis嵌套listt的复制.两都均是函数.