I'd like to change one folder in my project into a submodule. This is my (sumplified) directory structure:
|-app <- the root of git project
|--themes
|--plugins
|--lib
Now, I want to turn app/plugins into a submodule so that I commit changes in this directory into a separate reposiotry.
After setting up a new repo for plugins, I've tired git submodule add <submodule-repository> plugins
, but then I receive a message the reads
app/plugins' already exists in the index
Sure it exists in the index since it was tracked as part of the main project repository.
How should I solve it? Should I perhaps delete the main .git
folder, add app/plugins
to .gitignore, commit again, and then run git submodule add
?
This actually raises another question, should a folder that is a submodule of the project be added to .gitignore
of the project that includes the submodule?