Git Flow: how it works and the advantages of this workflow
- Software development
The management and organization of workflows in software development are challenges for companies that seek agility and consistency in projects. For this reason, over the years, several alternatives have been created for an efficient version control system in the sharing, access and change of codes among developers. Git Flow is one of these models and aims to simplify the processes of developing and organizing project branches.
In this article, you will understand how Git Flow works and the advantages this workflow brings.
What is Git Flow?
Git Flow is a workflow model that seeks to simplify and organize the versioning of branches of a development project in Git. This strategy became popular in 2010, with Vincent Driessen, and turned an alternative approach to Trunk Based Development.
Git Flow can be used in any software project and is aligned with the practice of Continuous Delivery DevOps. In this sense, Git Flow assigns very specific roles to different branches and defines when they should interact. In addition, it has individual branches for preparing, maintaining and recording releases.
How does Git Flow work?
Git Flow works by using project branches, so it can be compared to a tree and its branches. In this workflow, branches can be divided into three types: Main, Develop and Support (Feature, Release and Hotfix), which are discarded after they fulfill their purpose. For each of them, some specific rules need to be followed to maintain versioning optimization:
- Main: it is the main branch that contains the source code in production. It is not allowed to make changes (commit) directly on this branch. The Master is still used to send commits to production;
- Develop: created from the Main branch, it gathers the codes of all branches and communicates with the Main. It contains the most updated source code and all new stable features that will be merged later;
- Feature: created from the Develop branch, it is a temporary branch that carries new functionality to the project, it will always end up being mixed into Develop itself through a merge. And it follows a “feature/new-feature” naming pattern.
- Release: it is a temporary branch that will make the new resources stored in Develop merge into the Master branch, receiving a tag that indicates the new version of the project.
- Hotfix: it is a branch used to merge corrections into the main branch due to bugs identified in the development process. After a bug is fixed, the code will go to both the Main and Develop branches. This branch also receives a tag indicating the new version in Main.
What are the advantages and disadvantages?
Git Flow has its advantages and disadvantages, just like all other workflows. Therefore, it is necessary to analyze the workflow that best suits the project. Learn some advantages below:
- It is a workflow that values organization and practicality;
- Turns the development process more intuitive;
- Solves problems and bugs in the code instantly;
- Makes easier team collaboration and access to individual progress.
On the other hand, there are some disadvantages:
- Although it seeks to be practical, it can become a complicated and long workflow, depending on the project;
- It requires prior knowledge and training in large projects to maintain its fluency.
Would you like to know which optimal workflow for a given project should be? Or understand how DevOps can boost your company’s deliveries? Talk to our experts and get to know the services and consultancies offered by Objective!