2

I have a project where the only difference are the templates.

The question is how should I manage this with git now?

At the moment I have 3 different git Repos, but it's hard to maintain all 3 of them.

What would be a good solution for this problem?

1 Repo for the Codebase and 3 for the different templates(submodules/subtree)?

Edit: It's a PHP Project, with templates i mean the gui/frontend(html,css,js...)

-app
-Resources
    -Template
       -js
       -css
       -html 
    -Images
    -Translation
  • Can you specify what you mean by "template" in this context? – Thomas Stringer Jul 27 '15 at 15:30
  • @ThomasStringer i added the needed information, hope it's clear now – demonking Jul 27 '15 at 15:44
3

A couple of suggestions that might make this easier to handle by changing your project structure a bit.

First, you are right that managing this in three different repos is probably too much work. Generally I have found that splitting different software components that all seem to make sense to a general project by folder in a repo is a good way to modularize your code and resources.

If you haven't thought about the concepts of Continuous Integration and Continuous Delivery then this is worth looking into.

Continuous Integration

This approach is about mainlining all of your active development threads into a single branch. Also playing into this is organizing the automation of packaging and versioning your code such that it can be deployed easily. This can be done through tooling or scripting, I am not sure what tooling is out there for this in PHP, but you should have the ability to package modules of PHP software components (or groups of pages) as well as static resources from a template of your choosing in another folder entirely in your repo.

Continuous Delivery

This discipline and approach is concerning using tooling or scripting to take a packaged build and deploy it one quick to one or many environments for testing or production.

So what does this mean to you, well if you were running on Apache then typically your static resources would be in a separate physical file location that can be served from and this would be mapped to a different context root than typically would be your dynamic PHP page content. The two could feasibly live in separate file locations so they can probably and should probably be treated like separate independently themed and versioned software components, each with their own packaging behavior and each with their own deployment behavior.

It makes sense to keep your templates in another folder and to be treated like different software modules in your Git repository.

The added benefit of this is with one-click deployments for each type of template build of your choosing, you get 1 step closer to the Joel Test.

  • Thx for this great answer :) – demonking Jul 28 '15 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.