zoukankan      html  css  js  c++  java
  • Remove a Submodule within git

    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

  • 相关阅读:
    web工程导入新环境的注意事项
    Mysql group by,order by,dinstict优化
    Dijkstra and Floyd算法
    百度面试题
    腾讯面试题
    百度笔试3
    百度笔试2
    百度笔试1
    百度2011实习生招聘笔试题
    百度2011.10.16校园招聘会笔试题
  • 原文地址:https://www.cnblogs.com/Langzi127/p/3328765.html
Copyright © 2011-2022 走看看