Search code examples
gitproduction-environmentbranching-and-merginggit-flow

How to manage and develop two slightly differents branches


I have some software in my git repo.

  • "master" branch for actual unstable state
  • "prod" for production ready
  • And also I have branch "clientA" which is close to "prod" but have a lot of work-arounds about old libs/APIs

example

When I have finished featurebranch with the new functionality, I want to apply this for clientbranch and for prod branch.

after

Usually, I do this with cherry-pick, but in real life I have more than one clientBranch, and that is hard enough.

I am still sure, that it should be better way to manage this.

Please, point me to right direction.


Solution

  • I think that the good way to do it is to create your feature branch from the last commit common to your 2 branches prod and clientBranch.

    Then, when you think that your feature branch is OK, then merge it into prod and clientBranch.

    Hoping that code has not diverged too much from your common ancestor and that merge will be easy...

    Like what is done with the green branch in this workflow that is merged back into master and development.

    And also I have branch "clientA" which is close to "prod" but have a lot of work-arounds about old libs/APIs

    But perhaps the best thing to do is rather rebase (or merge) your client branch onto prod to keep them in sync if in clientBranch, you only have these work arounds...