Create Submodules/Managing Submodules authored by wmaahs's avatar wmaahs
This page contains useful tips for when you are managing submodules.
**How to remove a Submodule**
1. Delete the relevant line from the [.gitmodules](https://git.ece.iastate.edu/danc/MicroCART/-/blob/d45a6d510a134acee40c10da9a22a6d51b9d5137/.gitmodules) file in the parent directory of the parent project.
2. Delete the relevant section from .git/config
3. Run ```git rm --cached path/to/submodule``` (no trailing '/')
4. Commit and delete the now untracked submodules files.
**How to put a submodule, back into your project, but not as a submodule (un-submodule)**
1. Delete the reference to the submodule from the index, but keep the files:
```git rm --cached submodule/path (no trailing slash'/')```
2. If it was the only submodule in the .gitmodules file, then you can delete the .gitmodules file all together. Otherwise, just remove the one submodule that you wish to integrate.
```git rm .gitmodules```
3. Remove the .git metadata folder _(you probably want to make sure you have a backup of this first)_
``` rm -rf submodule/path/.git```
4. Add the submodule to the main repository index:
```git add submodule/path git commit -m "remove submodule"```
--------------------
**References**
[atlassian.com](https://www.atlassian.com/git/articles/core-concept-workflows-and-tips)