A better Gitflow diagram with branches, merges and color
Developers deserve a better Gitflow diagram, so we've given it to them. See the new and improved Gitflow diagram with support and bugfix branches and a bit of color.
There are three problems with the way the standard Gitflow diagram is presented:
- There is no differentiation between merge, branch and git commits.
- Colors are not used consistently.
- Support and bugfix branches are typically omitted.
In the enhanced Gitflow workflow diagram above, colored arrows differentiate between merge, branch and commit operations in the following way:
- Green is a branch operation.
- Blue is a merge.
- Gray signifies the commit ID of the branch's HEAD has moved forward, either through a local commit or an off-graphic merge operation.
Gitflow diagram branch colors explained
Another shortcoming of the standard Gitflow workflow diagram is that colors are not used consistently.
The master, or main branch, should always be purple. Purple is a royal color, and since the main branch acts as the source of truth for any repository, the royal treatment is befitting.
The hotfix branch should always be red. And the develop or development branch should always be green. This is where features are added and non-production bugs are fixed. Green means go, so it should denote the branch that moves project development forward.
The feature branch should be blue. This is where developers experiment with code as they try to implement new features, and where programmers can brainstorm strategies and apply blue-sky thinking. So, blue is the right color here.
The release branch should be yellow. The release branch is a feature-complete capture from the development branch. It should be treated with caution, as the code that resides here will get merged into main, representing a new source of truth for the project. Developers should be cautious with commits to the release branch, so the color yellow is appropriate.
Gitflow support and bugfix branches
The enhanced Gitflow diagram also includes the often-missed support and bugfix branches.
The support branch exists to provide updates to any previously released branches that might need patches and bugfixes. Support branches will be minimally active, so they are best colored gray.
Like the feature branch, Gitflow bugfix branches off and merges back into the develop branch. A bugfix is like a feature in how it branches and merges, but it shares functional characteristics with a hotfix, so it's colored orange -- a compromise between the blue feature and the red hotfix.
Put all of these improvements together and you get the enhanced Gitflow diagram above.