Jil
Jil

Reputation: 45

How to pull submodules from a subtree repo?

I want to add an external lib as a subtree. But this lib contains a submodule and I can't figure out how to get it.

I usually add a subtree manually, by adding a remote and use:

git read-tree --prefix=remote -u remote/master

Has anyone ever dealt with submodules in subtrees ?

Thanks

Upvotes: 3

Views: 406

Answers (1)

phd
phd

Reputation: 94483

As far as I understand the library has file .gitmodules at the top of the library tree. When the lib is included as a subtree in a superproject the file .gitmodules is in the subtree while git expects it at the top of the repository.

I can think of a few ways to work around the problem (symlink, copy) but my recommendation for this situation is to avoid subtree at all. You have to work with submodules anyway as the lib contains a submodule so why not make the very lib a submodule instead of a subtree?

Upvotes: 2

Related Questions