How to delete submodule in git: 1. Use "vim .gitmodules" to delete the file corresponding to Submodule; 2. Use "vim .git/config" to change the information in the git configuration file and delete the submodule related content; 3. Delete the submoudle in the modules directory.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
Delete submoudle
git does not support direct deletion of Submodule and you need to manually delete the corresponding file:
1. cd mainproject git rm –cached submodule rm -rf submodule The above will delete the submodule file
Delete the corresponding submodule information in .gitmodules, as shown below
$ cat .gitmodules [submodule “submoudle”] path = submoudle url = https://gitee.com/ddonggua/submoudle.git [submodule “submoudle2”] path = submoudle2 url = https://gitee.com/ddonggua/submoudle2.git
2. Change Git configuration file config: vim .git/config
You can see the Submodule configuration information:
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote “origin”] url = https://gitee.com/ddonggua/Test2.git fetch = +refs/heads/:refs/remotes/origin/ [branch “master”] remote = origin merge = refs/heads/master [submodule “submoudle”] active = true url = https://gitee.com/ddonggua/submoudle.git [submodule “submoudle2”] active = true url = https://gitee.com/ddonggua/submoudle2.git
Delete submodule related content,
3. This is because the submodule information has not been cleared yet. You still need to delete the submodule in the modules directory.
This will completely delete the submodule information, and then submit it to the remote warehouse, over
Recommended learning: "Git Tutorial"
The above is the detailed content of How to delete submodule in git. For more information, please follow other related articles on the PHP Chinese website!