Removing a submodule
Wednesday 17/07/19
Don't you love it when you move the wrong repository into your repository as a submodule? That's what happened to me.
You can't simply delete the submodule folder from a Git Repository. The submodule is referenced in other files.
Here's how to remove a submodule from a git repo!
Open up your Command Prompt / Terminal / Powershell and navigate to your git repository.
Run
git rm --cached [Submodule Name]
Delete the
[Submodules]
entry from the.gitmodules
file.Delete the
[Submodules]
entry from the.git/config
file.Commit the changed untracked files.
Delete the submodule folder.
Delete the submodule directory in the
.git/modules
directory.
Last updated
Was this helpful?