Question

My company has its own CMS and we need to create new websites using it. We use GitHub as VCS. The problem is that some websites require some changes to the internal code (I know the CMS is not so flexible).

I thought I could create a new branch for each web site: 'master' for the base CMS, and 'website1' for the first website, 'website2' for the second one etc..

As I said, I need to make lots of changes to each branch and to commit them. What if I have a fix to make to them all? I though I could switch back to 'master', fix it, and then merge with each 'websiteX' branch. Is there any problem doing so? What if meanwhile I edited the same file in the website's branch?

Do you suggest creating a new repo for each website? With this option, I'll lose all the benefits of merge and I'll have to fix each website by hand.

Thank you

Was it helpful?

Solution

The approach you described is generally the best way to do this. Git does very well even if you merge stuff back and forth a lot. Of course, if you change the same part of the code in both master and website1, the merge from master to website1 will create conflicts, but those are pretty much a normal part of merging anyway.

Whether you use multiple branches in one repo or several repos doesn't make that much of a difference. After all, you can fetch/push from/to multiple repositories. That said, in my opinion multiple branches in one repo are just fine for your scenario.

OTHER TIPS

Would there be any benefit, if you would use your websites as modules to the core?

http://git-scm.com/book/en/Git-Tools-Submodules

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top