Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git-flow and client-specific functionality

Tags:

git

git-flow

How would you recommend to manage client-specific functionality and change requests within Git-flow, or Git in general? Should client-specific features be in a separate branch dedicated to the client? (Each client having its own branch from the develop branch.) Or should they be in a separate repository? (Each client having a dedicated repository, with the master repository being our main repository.)

like image 381
Ariod Avatar asked Apr 20 '12 08:04

Ariod


People also ask

What is Git flow used for?

Gitflow can be used for projects that have a scheduled release cycle and for the DevOps best practice of continuous delivery. This workflow doesn't add any new concepts or commands beyond what's required for the Feature Branch Workflow.

What is the difference between Git flow and GitHub flow?

Git Flow is usually more complicated than GitHub flow. It is used when your software has the concept of “release”. This flow works perfectly when you work in a team of one or more developers and they collaborate on the same feature.

What are the three types of branching in Git?

The two primary branches in Git flow are main and develop. There are three types of supporting branches with different intended purposes: feature, release, and hotfix.


2 Answers

It sounds like you have a code base that all clients use, and then you have some "hacks" for client specific functionality.

In my opinion, you would have all of the "base" code on the master branch. All clients would have a client specific branch. Be careful and know where your changes are being made.

Every so often, make sure you rebase your client branches, basically bringing them up to the base code and then replaying all of their specific changes on top of that.

Rebasing can be quite confusing until you see it in action.

Using sequential commit numbers for clarity. Commits are not numerical in real life

Master is at commit 10
 \
   Branch has commits 10, 11, 12, 13, 14, 15 (notice it has commit 10 as well)
|
Master commits 16, 17


When you rebase:
  Master has 10, 16, 17.
  Branch has 10, 16, 17, 11, 12, 13, 14, 15 

The order here is very important. Rebase rewinds the branch to 10, applies 16 and 17, and then replays its changes of 11, 12, 13, 14, and 15.

At this point, as long as there are no conflicts, the branch is up to date with master AND has the client specific changes.

like image 138
John Congdon Avatar answered Sep 19 '22 12:09

John Congdon


I would create a separate repository for your base and clients. The clients would have a base that would have a remote branch, being your base. When a client needs a new release it's much easier this way. If you would put all clients in one repository, you would have to manually change the integration/developer branch before you do a git flow release start. This would limit your ability to work on multiple releases for different clients.

like image 35
Peter van der Does Avatar answered Sep 22 '22 12:09

Peter van der Does