I have a single git repository with multiple projects. The code of each project is found under a dedicated subdirectory. Each project has it's own deploy procedure. I would like that when I push a commit under the project's directory it would deploy the right project (and only it). I am currently using bitbucket pipeline, however, it seems, that it doesn't have this option. How can I make this work? ( I can switch to another CI/CD tool )
It does not have this option because this is not how git is used.
For projects that are to be separately deployed there should be one repository each. This will allow you to fine tune the deploy procedures individually in a manageable and documentable way and, even more important, keep the history clean. Imagine now in your situation you need to review a specific project's history - you will end up digging though all the commits of the other projects trying to find the ones you are looking for.
There is a solution though if you need the projects interconnected and under common version control: submodules. Check out the official docu here. It will allow you to keep track of individual histories and share resources at the same time. Also it will give you distinct control over the versions of each project being in the shared space.
So my solution to your problem: Refactor. Separate the projects to individual repositories, each with its own deployment strategy working just fine. If you then need to interconnect them and share resources make them submodules, create a new repository and add them in as submodules. This should solve your hickups with a messed up history and uncontrollable folders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With