0

I confused the concept of Git submodules.

I created separate repositories intended to be submodules of another project, then in the main project repository I added empty folders to where these files should be added.

example:

MyProject/
   ./lib
   ./headers
   ./source

those folders are empty because the contents will be coming from the separate repos as submodules but the thing is that they are named differently. the contents of lib/ will be coming from lib_trunk submodule and source is called source_trunk

is there a way to tweak the submodules feature in git to instead clone the repo as named it will just add the files contained in the repository?

1 Answer 1

2

You don't need to create the folders in advance, git will do it for you. And those folders can be named differently than the -submodule- repositories they contain.

git submodule add url/to/lib_trunk lib

will initialize a submodule in a lib folder from a repository called lib_trunk. Same thing with source.

If, as you say, both lib and source already exist, you may have to delete them before doing git submodule add (but as they're empty there is no reason to keep them).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.