Home > database >  Git Structure when dealing with clients
Git Structure when dealing with clients

Time:02-12

Please bear with me. I'm not a git expert so I may be wrong with everything I'm even saying here.

Ok. So I saw a few questions that are similar to this one. However, I feel like mine is different enough to ask here.

We have several microapps that we have created in Github. I feel I took out all of the common parts between the microapps and separated them into a sort of library for all of the microapps to use.

Clients will purchase our microapps but sometimes want them customized in a way that's not as common. However, no matter what there are a majority of files that don't change in each microapp.

I created a repository for each microapp and for the library. I have questions on how to structure the clients' repository.

My current structure is the following:

MicroApp1
|-- File 1
|-- File 2
|-- File 3

MicroApp2
|-- File 1
|-- File 2
|-- File 3

MicroAppLibrary
|-- File 1
|-- File 2
|-- File 3

My first question would be how should I include the library in the main microapp repositories? From my understanding, I should use submodules. I want to be able to update the library repository and merge it to all of the microapp repositories.

My second and deeper question is how I should structure the clients' repositories? The way I'm thinking of doing it is by having one repository for each client. In each repository, I would have directories basically containing the repositories. Like the following (if i don't do the submodule and instead just clone the library every time):

Client 1
|-- MicroApp1
    |-- File 1
    |-- File 2
    |-- File 3
|-- MicroApp2
    |-- File 1
    |-- File 2
    |-- File 3
|-- MicroAppLibrary
    |-- File 1
    |-- File 2
    |-- File 3

My problem with that is how to update and merge the code to all of my clients' repositories? For example, If I make a change in the main repository of a microapp, how would I push that change to all of my clients' repositories? It doesn't seem like I can merge a repository to a directory. Would I instead use branches? There's quite a few microapps, and I would want a dev and prod branch on each of them as well.

I have many more questions but feel like it'll be too much for one post.

CodePudding user response:

  1. Forget about submodules, use subtree
  2. If GitHub, then each client's MicroApp repo is created as fork of base MicroApp, and all customer-specific customization performed in it, while you can always pull common changes from base

CodePudding user response:

There's a special GitHub App for that, called Git X-Modules. Unlike submodules, this tool allows you to add only certain folders from a repository as a module, and updates automatically in the background. So you can create a separate repository for each of your client, add the needed components to it, and set up a one-way synchronization (so that updates from the main project repo are pulled to the clients' repos, but not vise versa).

  • Related