Reputation: 157
I have a git repository with a web project. I want to customize this web project for different customers.
For example i have two customers c1 and c2. So i create two git branches: c1 and c2.
Every version has the same base system but different features. If i want to add a new feature or fix a bug in one branch there is no problem. But what if i want to change something that concern both branches. This results in a large amount of merge conflicts.
Can someone show me a better solution for my problem?
Upvotes: 9
Views: 3065
Reputation: 164
I like GitHub feature Fork for solving such problems, main idea is to have separate repositories and copying commits using Pull Request or in some other way, with such approach both repositories will have common base and then will evolve as separate repositories.
To use same approach it is not necessary to use GitHub, you can just create several git repositories and then add additional remote, instead of Pull Request you can just use cherry-pick for copy commit from one repository to another. This approach will not help with solving conflicts in some better way.
Also you should think about modular way for development of common parts as separate modules, this can be done with submodules or with some other approach related to your programming language for example in Java you can develop module separately and then use it from other projects using dependency management functionality of Maven, Gradle or Ivy.
Upvotes: 4