简体   繁体   中英

How to manage this project structure with git?

I'm developing addons for a web software which has its structure set up like this:

root
--index.php
--js/
----addon1/
------file.js
----addon2/
--css/
----addon1/
------style.css
----addon2/
--library/
----addon1/
------file.php
----addon2/
------file.php

I want to create a repository for each addon, but with the current structure it doesn't seem possible. The main chunk of the code for addon1 for example would be at /library/addon1/ and public assets for that addon would be at /js/addon1/. However if I set up the repository for addon1 at /library/addon1/ I cannot track the files outside in the js and css folders. Placing the repository one level up would mean I couldn't track each individual addon. Unfortunately I don't have the flexibility to move around the folders.

I have looked in to submodules, but I'm not sure that is what I need. There is no "main" or core repository as I don't need to track the main software, only my own individual addons that I create.

Is there any way to set this up?

Forgot to note that I don't need anything too complex as I only use these repositories locally and do not need to share them with anyone.

A simple architecture for this is to put the development of each addon in a branch.

Each addon can then be developed autonomously from the other addons. As you need more recent code from different addons due to dependencies, it is easy to use the git merge (with cherry-pick if needed) to bring those features into the correct branches.

Then, when you are ready to make a "stable" release, a "stable" commit from each addon branch can be merged into a release/trunk/master/stable (you can pick the name) branch. That way, each addon can be in a different stage of development, but code releases can still be assembled without stalling the development of any addon.

All within the same repository!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM