From:http://www.worldhello.net/2010/01/26/425.html
There are two scenarios for deleting git submodule (Git library sub-module) to create Git submodule (Git sub-module)
- Explicit add: Use the git submodule command to add other git libraries as subdirectories, which are sub-modules
- Implicit add: Add using git Add, if a subdirectory itself is a git library, it is automatically added as a sub-module, no longer recursively add files under that directory
So what's the difference between the two ways of adding a sub-module? What are the side effects of sub-modules? How do I delete a module? Two ways to add a module, the effect is slightly different
- Implicit way to add, it seems that the directory is directly added to the repository, but in fact, add a directory name with the same name of the submodule entry;
- Explicitly added, in addition to creating an submodule entry in Index/commit as an implicit way, a. gitmodules file is created, and the corresponding record is created in. Git/config. See the git submodule command for details.
Side effects of sub-modulesSometimes it is not realized that the directory is added as a module. For example, when backing up files and directories with Gistore, when a directory itself is versioned with Git, the directory is added as a sub-module. How do I add a sub-module to a version control system in the normal directory format? Do not do this in the following way:
- Delete the. Git directory of the sub-module and delete the Git repository under the sub-module
- When executing git add times error: Fatal:path ' ... ' is in submodule ' ... '
So, what should we do? How to delete a sub-module
使用 git 命令即可删除子模组
git rm --cached path/to/submodule
for explicitly defined sub-modules, also delete the. gitmodules file and the associated entry in the. git/config file.
Git submodule (reprint)