I'm not very proficient in git beyond the usual commit/pull/push/branch
etc. commands, so I don't know the proper words I need to search for what I want to do.
I'm looking for advice on how to get to what I want and pointers to URLs and such that give more explanation.
Over time a project has evolved from a single product to several subproducts that are used to build the final product. Each subproduct has it's own subdirectory tree but the Jenkins jobs that build the subproducts and the final product still pull in the entire repository just to build the one product it's supposed to do.
This takes quite some build time, even for the small products that don't change a lot over time. So I'm thinking of splitting off each of the projects into its own repository. At the same time they all follow a similar pattern for several files so I'd like to move that into common code that is used by all. Here is a schematic layout
/project
/subproject1
/common
/src
/test
/subproject2
/common
/src
/test
/common # main project
/src # main project
/test # main project
From what I've read so far I think the best thing to do is to split all subprojects and the main project into separate repositories. Preserving history would be nice, but commits have spanned multiple subprojects in the past and no branches were used, so that might not be feasible.
Also, when I move the common code off into its own repository, how do I get the files back into the common directory so that a change in the common code gets pushed to its own repository? I've read about git-subtree
that could do the trick, but I've never used it.
Is this the best way forward or are there simpler alternatives?