Hi everyone,


 We have a product with different themes, that are stored in master branch 
like this

themes/theme_one/...
themes/theme_two/...
etc

To reduce the number of duplicate templates, all these themes inherit from 
the master theme that is located in templates/ and individual theme folders 
have only the templates that need to be changed. So when framework requests 
a template file test.html, first of all themes/active_theme/test.html is 
checked. If it does not exist, we use templates/test.html that is 
guaranteed to exist. CSS files are stored in the same folders and follow 
the same logic.
 
Sometimes one of our customers wants to have a custom theme. Since we have 
a wide variety of themes, there is usually one that is highly similar to 
what the customer needs and which requires cosmetic changes only. So what I 
usually do is create a branch new_customer, switch to that branch, copy the 
theme of choice (e.g. themes/theme_two/ -> themes/custom_theme/) and modify 
it, applying the changes the customer needs. Sometimes the changes are 
minimal, sometimes they are larger but the resultant theme still heavily 
inherits from its parent.

As a result what we have is a complex branching logic. For a given 
themes/custom_theme/test.html:

   - if themes/theme_two/test.html exists, it is branched from it; any 
   change applied to themes/theme_two/test.html should be possible to merge 
   in themes/custom_theme/test.html
   - if themes/theme_two/test.html doesn't exist but templates/test.html 
   does exist, the file is branched from templates/test.html. And changes 
   to templates/test.html should also go to themes/custom_theme/test.html
   - if the above files don't exist, then the template is unique to this 
   theme and doesn't get branched from anything
   
What is the most efficient way to organize that? Suppose we've noticed some 
random bugs in themes/theme_two/ and applied the fixes. Is theme some way 
to tell Git that themes/custom_theme/ is in reality something like a branch 
from themes/theme_two/ (and templates/) and all the changes should be 
reapplied there as well.

Some time ago I was reading a book on Git and I vaguely remember something 
about submodules. Is it the classical way to solve such a problem and if 
yes, how will it work? Will I do something like this - set up a separate 
repo for themes with templates/ being master and each theme having its own 
branch and then in main product master create themes/.../ and templates/ 
folders and link them to respective submodule branches. Then when l need to 
create a custom theme, I'll create a some_customer branch from main 
product's master, create a branch from the other repo's theme_two branch 
and load it as a submodule into themes/custom_theme/ of the new_customer 
branch?


 Regards, Eugene B
 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/GbHPaChSNJEJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to