5

I have an application main which consists of multiple submodules A, B and utility_functions: Both of these submodules A and B by itself include the submodule utility_functions.

main
|
|---- A
|     |
|     |---- utility_functions
|
|---- B
|     |
|     |---- utility_functions
|
|---- utility_functions

Right now I have the utility_functions three times in my project. Usually sub_A, sub_B and main should all point to the same commit of utility_functions.

It is necessary that the code from the repository A is run-able by itself. If I only clone A it should include my utility_functions

A
|
|---- utility_functions

Is there a way to only tell my submodules included in the main repository to rely on the same utility_functions? Or does this break the idea of submodules because they can point to different commits? Or is this simply a bad idea?

main
|
|---- A
|     |
|     |----
|         |
|---- B   |
|     |   |
|     |   |
|     |   |
|---- utility_functions

1 Answer 1

2

Or does this break the idea of submodules because they can point to different commits?

Yes, that wouldn't be practical precisely because of that reason.

If you are sure that A and B should always reference the same version of utility_functions, then clone your main repo and update only A, B and utility_functions (without the recursive option), and make a symlink from A/utility_functions and B/utility_functions to ../utility_functions.

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

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.