Home > Back-end >  Good practices structuring Git repository [closed]
Good practices structuring Git repository [closed]

Time:10-07

My team is required to rewrite a highly modified moodle platform. The way we are going to face it is creating several plugins integrated with moodle itself. Those plugins also get installed in several different files of the moodle folder structure. A very basic example would be:

/root

    /folder_1
        /plugin_1
        /plugin_2

    /folder_2
        /plugin_1
        /plugin_2

That raises the problem of structuring our git repository, as the deployment would get slow and cumberstone as the number of plugins raises

We are contemplating a basically three ways:

  • Indepentend Git repositories. Each plugin gets its own repo. As every plugin does a specific job, not necessarily related to each other, it would be a clean way to do it. The problem is having a large number of project that are actually related to each other in gitlab may look a bit ugly. Also the deployment might be the slowest, but the easiest to update a single plugin.
  • A repository per moodle folder. Easiest to deploy, but updating or fixing just a single plugin might not be so straightforward
  • Branch per folder. A big repository containing all the plugins, but having a number of 'main' branches that contain several plugins. Cleaner on gitlab, as all the plugins are in the same project, not so clean in the branches tab. Also working on different plugins would require checking out branches quite frequently.

Basically what I'm asking for is a bit of advice handling a larger and more fragmented project (to me) than usual. Thanks in advance.

CodePudding user response:

You probably want to use git submodules

These are independent git repos for each plugin, but you can use the main git project to synchronise them.

There is a guide here that describes the process for Moodle 3.9

https://docs.moodle.org/311/en/Moodle_development_environment_with_Git_submodules

  • Related