简体   繁体   中英

git common submodule of submodule

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM