Is there a better proposal to version control web-projects with small random updates in several customer projects with git?
I want to use git to version control for web projects. The main difference to almost all other proposals are that this is a web project using HTML, JavaScript and some PHP files - no central libraries used by one ore more programs, like usual in typical Linux packages.
All my different web projects are for different customers basing on the same platform files, I would estimate 80% of the files are identical (call them platform) and 20% are modified for different customers to fit to their needs. Problem here is, that I don't know for which files we need a customer update - in detail every customer is different.
Best would be to keep the platform specific files in one directory and overlay these files with customer specific files in another directory. To solve this with git I found nothing really good so far:
What is the best approach here?
This is actually an architectural design problem, not a source code management problem. Nevertheless, it's a common and interesting problem, so I'm offering some general advice on how to address your architectural issues.
The problem isn't really Git here. The issue is that you haven't adequately differentiated what remains the same vs. what will change between customers. Once you've determined the correct design pattern, the appropriate source control model will become more obvious.
Consider this quote from Russ Olsen:
[Separate] the things that are likely to change from the things that are likely to stay the same. If you can identify which aspects of your system design are likely to change, you can isolate those bits from the more stable parts.
Olsen, Russ (2007-12-10). Design Patterns in Ruby (Kindle Locations 586-588). Pearson Education (USA). Kindle Edition.
I don't know your application well enough to offer concrete advice, but in general web projects can benefit from a couple of different design patterns. The template, composite, or prototype patterns might all be applicable, but sometimes discussing patterns confuses the issue more than it helps.
In no particular order, here's what I would personally do:
Once you've refactored your application to minimize the changes between customers, you may find you don't even need to keep your code separate at all unless you're trying to hide polymorphic code from each client. If such is the case, you can certainly investigate submodules or separate branches at that point, but without the burden of heavy duplication between branches.
Lastly, if you find that you can isolate changes into a few subdirectories, Git supports symlinks. You could simply have all your varied code in a per-client subdirectory on your development branch, and symlink the files into the right places on your per-client release branches. You can even automate this with some shell scripts or during automated deployments.
This keeps all your development code in one place for easy comparisons and refactoring (e.g. the development branch), but ensures that code that really does need to be different for each release is where it needs to be when you roll it out into production.
Vendor branches make the most sense due to the nature of how you customize your solution for each vendor. The best way to go about it is to forgo this and develop a multi-tenant application.
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