# Removing a submodule

Don't you love it when you move the wrong repository into your repository as a submodule?  That's what happened to me. &#x20;

{% hint style="warning" %}
You can't simply delete the submodule folder from a Git Repository.  The submodule is referenced in other files. &#x20;
{% endhint %}

Here's how to remove a submodule from a git repo!

1. Open up your Command Prompt / Terminal / Powershell and navigate to your git repository.
2. Run `git rm --cached [Submodule Name]`
3. Delete the `[Submodules]` entry from the `.gitmodules` file. &#x20;
4. Delete the `[Submodules]` entry from the `.git/config` file.
5. Commit the changed untracked files.
6. Delete the submodule folder.
7. Delete the submodule directory in the `.git/modules` directory.
