D. Release Management — 1. Branching strategy

High level team requirements

  1. Team need a code base which reflects production-ready state or reflects state of current app in production.
  2. Team needs a code base where they can deliver latest changes for next release.
  3. Team needs to fix severe bug for code in production and release quickly.
  4. Team needs to work on new features release in isolation and parallel.
  5. Team needs a code base to prepare and test for next release work, while they continue work on future release in isolation and parallel.
  6. There are 2 or more developers working on each code repository. (For simplicity we assume 2 developers here.)
  7. Team may want to start work on Feature which should not be part of next release.

Achieve above requirements by using branching strategy

First two requirements mentioned above can be achieved using ‘Main’ (master) and ‘Develop’ branch.

additional requirements mentioned above can be achieved by creating Hot-fix, Feature and Release branches as needed.

Following example illustrates common branching strategy many teams follows.

Main (master) and Develop branches are immortal.

Hot-fix, Feature and Release branches has limited lifespan.

  1. Create develop branch from main branch.
  2. Create Feature-1 branch from develop branch and start work on Feature 1.
  3. Create Feature-2 branch from develop branch and start work on Feature 2.
  4. Finished work for Feature 1, create Pull Request and merge branch to develop branch.
  5. To keep Feature-2 branch up to date, merge develop into Feature-2 branch.
  6. Since developer 1 finished its work, it can pick work from next release. Create new branch, Feature-3 from develop and start work on Feature 3.
  7. Finished work for Feature 2, create Pull Request and merge branch to develop branch. (check rule 5_5 below)
  8. To keep Feature-3 branch up to date, merge develop into Feature-3 branch.
  9. Create Release-1 branch for Release 1.0 (check rule 1_1 below) (check rule 3_3 below)
  10. QA / UAT find issue during testing, create Issue-1 branch from Release-1 branch.
  11. Fix issue and merge Issue-1 branch into Release-1 branch.
  12. Cherry fix Issue-1 fix from Release-1 branch into Develop branch.
  13. All well and ready to release features. Merge Release-1 branch in Main (master) branch. Iteration ends. New release 1.0 in production. (Check Rule 2_2 below)
  14. In next iteration new Feature-4 branch is created from Develop branch and start work on Feature 4.
  15. Customer finds new severe bug in app. To fix it quickly, create new Hotfix-1 branch.
  16. Fix bug and merge Hotfix-1 branch into main to release bug fix.
  17. Cherry pick fix into develop branch. (Check rule 4_4 below)
  18. To keep Feature-4 branch up to date, merge develop into Feature-4 branch.
  19. To keep Feature-3 branch up to date, merge develop into Feature-3 branch.
  20. Finished work for Feature 4, create Pull Request and merge branch to develop branch.
  21. To keep Feature-4 branch up to date, merge develop into Feature-4 branch.
  22. Finished work for Feature 4, create Pull Request and merge branch to develop branch.
  23. Create Release-2 branch for Release 2.0
  24. All well and ready to release features. Merge Release-2 branch in Main (master) branch. Iteration ends. New release 2.0 in production.

Rules to remember

1_1 All feature branches targeting Features for next release must be merged in Develop before cutting Release branch. All features targeted at future releases must not be merged in Develop branch before release branch is branched off.

2_2 Change version name and number in release branch before merging to Main branch.

3_3 Once new Release branch is branched off from Develop, adding large new features here is strictly prohibited.

4_4 If hot-fix happens late in next release cycle and new release branch already branched off, then hot-fix must merge in Release branch and then eventually to develop branch.

5_5 If feature is very large and 2 or more developers working on that feature, then each developer creates own branch from feature branch. Once all work on feature is finished, then feature branch can be merged to develop.
Or use feature flag (FF) to merge individual developer work into development branch.

Summary

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store