Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manage multiple git release branches for multiple customers

Tags:

git

branch

My company has a piece of software we sell to multiple customers. But every customer have some different requirements (more than just "Put our logo here"). The core is the same for all of them, but some does not need certain modules, others need them all including modifications.

I would like to manage all of this in a single git repository so I have the same core for them all, but I'm not quite sure how to do this the best way.

I read about Git Flow, and how to make a single project succesful regarding branches, which gives a branch model like this:


(source: nvie.com)

Now, we have multiple customers, and therefore multiple release branches (release-customer1-v1.2, release-customer2-v3.8, ...), but they all build on the same master branch.

Are there any strategy to manage this chaos?

like image 671
Rasmus Bækgaard Avatar asked Aug 19 '16 09:08

Rasmus Bækgaard


2 Answers

I think a simple and viable solution might be to have develop and release branches for every customer.

Edit: previously develop was called master in the sentence before, but I like develop better


  • All the common things would live in the shared develop branch
  • Each customer would have it's own develop and release branches

You would have to take extra care to make changes that affect all customers in the shared develop and changes that only affect specific customers only on their respective branches.


Scenario I

You develop feature A for customer A, and feature B for customer B.

If those features do not share code they should be kept in the respective develop-* branches, e.g. feature A will be developed in develop-customer-A and feature B in develop-customer-B

If those features share code the shared part should be developed on the shared develop and the parts specific to the customers in their respective branches develop-*

like image 165
AnimiVulpis Avatar answered Oct 17 '22 01:10

AnimiVulpis


Thanks for @AnimiVulpis. His/Her answer gave me a hint. Here's my solution: (also base on the nvie's strategy)

1.Extract the exact common parts from project. Create a branch named shared/develop

2.Based on the shared/develop, creating a customer1's branch

git checkout -b local/customer1/develop origin/shared/develop
#push this new branch to remote
git push origin local/customer1/develop:origin/customer1/develop
git push origin local/customer1/develop:origin/customer1/master

3.Same with step 2. create other customers' branch.

4.All the common parts used for all customers should work on shared/develop branch.

4.All the feature development just for the customerN should work on its own customerN/develop branch.It should be note that all the customers' branches should merge from shared/develop branch before a new feature coding.

like image 44
Shengfeng Li Avatar answered Oct 17 '22 02:10

Shengfeng Li