Trusted answers to developer questions

How to delete a Git submodule

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

Git submodules are a powerful way to use Git as an external dependency management toolThis is analogous to creating a soft link on your system.. This shot covers what needs to be done when you delete a project that has a submodule in it.

There are four steps involved when you delete a submodule.

1. deinit the submodule

git submodule deinit <submodule_directory>

2. Remove the submodule directory from Git

git rm <submodule_directory>

3. Remove the submodule directory from .git/modules/

rm -rf .git/modules/<submodule_directory>

4. commit and push the changes

git commit -m"Removed Submodule"
git push

RELATED TAGS

git
submodule

CONTRIBUTOR

Anjana Shankar
Attributions:
  1. undefined by undefined
Did you find this helpful?