I’d like to create a new repository as a submodule of my project.
Usually, I create a Github repo and then add it as a submodule using the command
git submodule add url_to_repo.git
Is there a way to create a new repo directly as a submodule without creating the repo somewhere else first (neither locally nor remote e.g. on Github)?
I don’t see how you could: a submodule is by definition a SHA1 from another repo (ie the other repo must exist for the parent repo to extract said SHA1): you must have its address referenced in the
.gitmodulesfile that you keep in the parent repo.So you could create the submodule repo locally, but you must create it anyway.