0

My team has two GIT branches:

  • 'main' branch which services our production environment
  • 'update_1' branch which was forked out of main branch

The idea is that 'main' is our current production branch. We only allow small bug fixes to be added to this branch to resolve critical production issues. 'update_1' branch is the next release we are working on. This branch has larger feature items that take more time to develop and stabilize. Once development is complete in 'update_1', we will push this branch to production, and then fork a new 'update_2' branch out of 'update_1' branch to start working on the next update. 'main' branch will no longer be used once 'update_1' branch is pushed to production in its place.

Due to this branching model, any fix that is committed into 'main' branch, must also be integrated into 'update_1' branch, so we do not lose the fix when 'update_1' branch is pushed to production. Similarly, we need to integrate all fixes from 'main' and 'update_1' branch into 'update_2' branch (once it is created), so we do not lose any of our in-production fixes once 'update_2' branch ships to production.

Currently, this is a manual process. We have our developers cherry-pick their changes into the needed branches. This has a lot of overhead and often times delays while we wait for the dev to integrate their fix into the needed branch. I am looking to automate this processes.

Is there any scripts or automation that can resolve this issue? I need to integrate all commits that are in branch 'main' into branch 'update_1'. If there is a marge conflict, we would need to flag this commit for developer review.

Thanks!

Hampton Terry
  • 344
  • 1
  • 13
  • Your current approach sounds OK to me. If you really only commit hotfixes to `main` during development cycles, then you should actually be able to just merge `main` into `update_1` after making a hotfix. This would at least avoid having to deal with cherry picking. Merge conflicts sometimes need manual resolution and there is no silver bullet to deal with this problem. – Tim Biegeleisen Feb 08 '17 at 06:43
  • Our scenario: Suppose main branch is in production now. 'update_1' branch has been forked out of 'main' to start development of the next update. Devs are checking in lots of commits to 'update_1' branch. Sometimes these commits are for high priority bug that cannot wait until next release. In this case, we cherry-pick the commit from 'update_1' branch into 'main' branch and push the bug fix to production. – Hampton Terry Feb 12 '17 at 00:53
  • When we are getting ready to release 'update_1', we want to do a bulk integration from 'main' branch to 'update_1' branch just to make sure all the commits currently in production are also included in 'update_1' branch, so we do not lose any fixes currently in production. – Hampton Terry Feb 12 '17 at 00:54
  • The problem is in the bulk integration from 'main' to 'update_1' branch. 'git merge' does not work well in this case, since the fix that was cherry-picked into both branches have a different SHA hash. – Hampton Terry Feb 12 '17 at 00:55
  • Are you open to rebasing `update_1` on `main`, or is this out of the question? – Tim Biegeleisen Feb 12 '17 at 02:21

0 Answers0