Reputation: 1774
I am building a system with a foundation (You may call it a boilerplate or a framework) because the system need to be customized to deliver among many clients based on their specified requirement especially for look and feel and user experiences. So I need to create two repositories for my project. First one is a base repository contains ground level part for the foundation. The second one is the project specific repository which contains upper level part.
I'm looking for a solution to allow me to only have to open a project directory in a single workplace and can edit entire project inseparately. But after commit and push them, they go to different specific repository. One at a time git commands is acceptable.
If using git submodule add
, I can link from a parent repository to a child repository, so two project repositories may share and maintain the same sub-repository from their own sub-directory. But what I need is reversed from that. Projects do not among them share a common child repository but a common parent repository. Are there any Git's feature provided enable me to do that? Or any workaround either with Git or on client side? Or any way I can do it with submodule
but may restructure it later on client side?
What have I tried
I can't find any solution yet using submodule
. Not directly but I've managed to pull from multiple remotes and merge them, solved half of my problem. But still finding out how to select which files going to which remote on push.
Upvotes: 1
Views: 56
Reputation: 3470
If your superproject (the root project in proper git nomenclature) never changes, but the submodules do, you should manage this in two environments: development and building.
There is no way of doing what you need from git and version every combination. Typically, the superproject includes the submodule, not the other way around.
Probably, the best alternative (and here is speculation) is to include all submodules in the root, and use pre-processor directives to instruct the compiler about which submodules are to be compiled each time.
If that is not an option, you should at least review your architecture, or go on and use other technologies. With vanilla git, you can try to load and unload modules directly from the development machines.
Another option is to define clone macros to generate each working tree dynamically (clone superproject, add submodule X, deploy on machine for development), you can achieve this via any bash/batch scripting.
Upvotes: 1