At the centre of most modern software development is a branching strategy that fits comfortably, is adaptable and can easily be enforced. Although the git flow lends itself to projects that have a scheduled release it is still pivotal even when working with microservices with shorter times and quicker releases.
Master and Development branches
This workflow uses two branches to record the history of the project. The master branch stores the official stable release history, and the development branch serves as an integration branch for features and bug fixes.
Bugfix and Feature Branches
Bugfix and Feature branches are created from the development branch. When a bugfix or feature is complete, it gets merged back into the development branch.
$ git checkout development $ git checkout -b feature/SB-123
Once the local development of code has been completed.
$ git pull $ git add * $ git commit -m "#SB-123 New dog enum for Pets" $ git push --set-upstream feature/SB-123
A production Hotfix is very similar to a feature branch release except that you do your work in a branch taken directly off the master branch.
Create a Hotfix branch based off the master branch that is currently deployed to production.
$ git checkout master $ git checkout -b hotfix/SB-1121 $ git push --set-upstream origin hotfix/SB-1121
Fix the bug, and commit.
$ git add * $ git commit -m "Add missing cat Enum" $ git push
Following a workflow based around git flow the following table can summarise the relationship between branches.