Skip to content

Instantly share code, notes, and snippets.

@subodh-malgonde
Forked from myusuf3/delete_git_submodule.md
Last active October 23, 2018 07:17
Show Gist options
  • Save subodh-malgonde/53e6cbe379e44b67bc6d461d4f6bca92 to your computer and use it in GitHub Desktop.
Save subodh-malgonde/53e6cbe379e44b67bc6d461d4f6bca92 to your computer and use it in GitHub Desktop.
How effectively delete a git submodule.

To remove a submodule you need to:

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule

git commit -m "removed submodule"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment