1

I'm working in a couple of websites, both websites needs almost the same code except for some changes in images and css, or settings.

I'm just finished to read the chapter of branchs of Pro Git book and i'm a bit confused, if a branch is not the best solution for this problem, is a fork?

I mean, we have instances A and B of the code, between A and B, the differences are things likes css colors, urls, api keys, but most of the code is the same, so in what way I can deal with this, i need something like code in A and then 'patch' it to get B, but i'm not sure how make a merge that doesn't overrides images...

Anyway, if is a branch or a fork, how can I make a merge for new features in A without lost changes in B?

diegueus9
  • 117
  • 5

1 Answers1

3

I don't think either branching or forking is going to solve the problem for you. I believe you need to approach this from a completely different angle.

The code that is shared between the sites is effectively a code library, and should therefore reside in a common library folder. In a LAMP environment, that would be /usr/share/php/. The individual sites then form projects of their own, with folders for CSS, JS, images, etc, and a few files that make use of the library code. If this is done intelligently, you probably only need an index.php file (and some rewrite rules).

Right now this probably sounds like a huge task, but I am pretty sure that branching or forking in git is not the way to approach this problem.

wolfgangsz
  • 8,767
  • 3
  • 29
  • 34