Gitflow
Gitflow is a git workflow for software development teams.
How Gitflow Works
Instead of having a single master
branch, there are instead two branches, the master
branch and the develop
branch.
The master branch records the history of the project and the develop branch serves as an integration branch for new features.
Release Branches
Once a release is due, usually at the end of a sprint when a shippable increment has been produced.
A release
branch is forked off of develop
.
This release branch marks the next release cycle so no new features are to be added after this point.
Bug fixes, documentation and other release tasks are allowed.
Once the release branch is ready to ship, it is merged into master and tagged with a version number.
Benefits Of Release Branches
There are several benefits of using a dedicated release branch.
It allows for part of the team to polish off and finalise the release whilst the rest of the team continues with the adding features and bug fixes on the develop branch.
In addition it also creates well-defined phases of development, e.g. we are releasing version 2.0.
Hotfix Branches
Hotfix
branches are used to quickly patch issues in production releases.
Hotfix branches are forked off of the master branch and are the only branches that should be forked off of master.
Once the fix is complete it should be merged into both master and develop
Benefits Of Hotfix Branches
The benefits of having dedicated hotfix branches is the the team can fix production bugs quickly without disrupting the rest of the development flow.
Bugfix Branches
Bugfix branches are exactly the same as features branches except they are for fixing bugs.
Branches Naming Convention
The gitflow workflow specifies 5 types of branches:
- Master
- Develop
- Feature
- Release
- Hotfix
This means that if there is more than one developer working on a features, then they are both going to be working on feature branches.
So how should these feature branches be named?
The best way is to name branches as follows:
<BRANCH TYPE>/<BRANCH NAME>
For example if a developer is working on an authentication feature, they would name the branch:
feature/authentication
bugfix/authentication-bug
References
Further Reading
If you enjoyed this article you will also find this article interesting.