How to work with submodule in Github

Assume I have 6 repositories in Github A,B,C,x,y,z. They have some complex dependent relations. x is built on A and B. y is built on B and C. And finally, z is built on x and y. The ‘built on’ is realizing by attaching the submodules. We see that if I download code z, it will contain two copies of B because both x and y are using B. When my project becomes larger and larger, I guess there will be lots of reduplicate copies. How to solve this problem?

@HengyueLi you might find an answer to your question at: