It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other.
I frequently need to look up the exact series of commands remove a git submodule. This post is primarily for my convenience, but may be useful to others as well.
Remove the relevant
submodule section from each of the following files:
- Stage changed
- Unstage and remove submodule path from the index (don’t include a trailing slash – that will lead to an error)
- Remove submodule files from index
- Commit the changes
- Remove submodule files
Removing a submodule can be a tedious task, but can be accomplished by following the tasks in this post.
((( - Enjoy your lighter repository. - )))