Recently one of our customers faced the challenge of fixing a production error in his desktop client application. Using SVN this may be a time consuming and error-prone task. So I held a workshop about Git and GitFlow.
Our customer’s application is deployed in different versions. It may also be deployed to different customers. With a different set of features. This scenario seems quite common nowadays. However a lot of software companies are not ready to tackle this problem.
The easiest and most effective way to support this scenario is to implement a workflow based on Git. Therefore I held a workshop about Git and GitFlow.
GitFlow is a basically a convention of how to use branches with Git. There are five types of branches:
- master: Every commit is one version. It can be deployed to a server. It is tested and stable.
- development: The new features for the next release are contained by development.
- feature-branches: Contains exactly one feature. When the feature is done, it is merged into development. It should be tested and reviewed.
- release-branches: Starts from development. Contains the features for this very release.
- bugfix-branches: Starts from the master branch. Bugfixes are merged back into the release branch AND into development.
There is one main difference between „classic“ (see e.g. this) and „our“ GitFlow. We treat the master branch as a sink:
- (Only) releases are merged into master.
- Master is never merged into any other branch.
So lets reconsider the definition of bugfix-branches:
- bugfix-branches: Starts from the corresponding release-branch. Bugfixes are merged back into the release branch AND into development. Finally they are merged into master.
Starting hotfixes from the release branches has two advantages:
- Clearness: Visualizing the branches shows a clear picture (see slides at the end of this article).
- Simple integration with CI / CD tools: Hotfixes can easily be reviewed and tested. They are not built / deployed immediately.
Working with GitFlow makes complex deployment scenarios simple. And its fun! especially if you previously tried to cover the same use cases using SVN 😉