I'm using GIT to manage a Content Management System (CMS) project. The CMS can have multiple plugin (module).
So basically, I want to have 3 types of repositories:
For the type 1 & 2, I guess it's simple basic repository. But when it come to client project, I get confused:
So the question is: How should I organize the repository(s) / files / folders in order to be efficient ?
In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
The layout you've described will work really well with git submodules. I'd gently recommend reading the docs and trying a few tutorials. The key difference your plan introduces is that each client repository and client plugin repository will have two remotes instead of one. And, when you want to start a new client project you will need to
A better option may be to use the same repository and simply make a branch per client. That is how I would do it.
Short update / additional information about the previous answer: if you don't like git submodules
approach or think this is too hard to understand, you can try
git subtrees
(check this article on medium)git subrepo
(easier alternative to submodules, on Github)Don't forget to check if you can use another depency manager (like RubyGems for Ruby, Composer for PHP...) instead of submodules, it would be easier to use and maintain.
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