0

I have a multiple subdomain website which has been setup as a single Git repository with dev,staging branches setup for each subdomain. This isn't working out very well as there is code being used across all subdomains to work with the database via Doctrine entities which end up with different versions of the entities in each branch and you end up with errors when the entities in the branch you are working on do not match up to structure of the database.

As the site is still in heavy development we need a way to keep common code updated across all branches like the Doctrine entities. Is there are better setup for this site?

The folder structure is something like so:


root
 - vendor
 - - (composer libs including Doctrine)
 - application
 - - models
 - - - Entities
 - - - - OldDB
 - - - - NewDB
 - - - Repository
 - - - - OldDB
 - - - - New DB
 - - modules
 - - - subdomain1
 - - - subdomain2
 - - - subdomain3
 - - - othermodule
 - - - moduleforsubdomain2
 - tests

Where the subdomains' code is contained within a sub folder of the main site. The whole site is one installation.

BeaverusIV
  • 988
  • 1
  • 11
  • 26

2 Answers2

1

One way would be to consider:

  • your main repo (root) as the parent repo
  • each of your modules as git subodules repos (independent repos)

That way:

  • each submodule is working with the the same parent repo version
  • you can make a submodule follow a branch (meaning if you 'dev' branch in root, you can create a similar branch 'dev' in the submodule, and make sure that each submodule update will set that submodule to its latest 'dev' SHA1)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Perhaps it is due to my lack of understanding of the system in question, but it looks to me like you only would need one single repo. Working with only one repo for huge SW systems works really well. In my opinion there should be no relation between SW structure (modules) and repos.

The submodule concept of git can be used when they are delivered separately and they have clean interfaces, but in most cases one single repo per system works very well. In your particular case it sounds like they don't have clean interfaces, which is why i suggest one big repo.

Martin G
  • 17,357
  • 9
  • 82
  • 98
  • Yeah, I've decided to merge everything, there wasn't as many conflicts as I thought there'd be. The main con is going to make sure everyone uses it right. – BeaverusIV Jun 12 '14 at 09:53