Home > Development Tools > git > How to delete submodule in git

How to delete submodule in git

WBOY
Release: 2022-06-24 15:18:49
Original
10784 people have browsed it

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.

How to delete submodule in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How to delete submodule in git

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
Copy after login

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
Copy after login

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!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template