1

We have a very common library will be used by a lot of small projects. Currently, we use submodule to add the library into the small projects and the small projects later will be used as submodule for extend feature projects and so on.

Then the problem comes, the project getting bigger and bigger. It has some many nested submodules and more than half of them now are the common library. I don't want to check out hundreds of times of the same common library when I check out the super project.

Is it any better way to do it with GIT?

Thanks.

2 Answers 2

1

You might want to look into using git subtree The blog post compares using subtree instead of submodule.

We don't use subtree or submodule. Instead we solve this problem by using a maven repository in which we publish common jar files. This along with a build system that lets you declare versioned dependencies solves a lot of problems.

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

Comments

0

Well, it seems that you can't do it with plain git (w/ submodules) because a submodules is tightly bound to a project. In this configuration all of your projects have to switch to a next commit of the shared library simultaneously, paths to library folder is a part of a commit etc. However likely your use-case needs that a build configuration won't be a part of the source tree, but rather an external entity. Android OS developers created a project called Repo which ties independent projects into a build configuration. So for each possible variant of components one creates a separate build configuration which then evolves independently from each other and independently from the component sources itself.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.