Skip to content

Blog

Gitflow: The Essential Workflow for Continuous Software Development

Paolo Fabbri

In the world of software development, version control is essential for managing and coordinating the work of several developers. Git is one of the most popular versioning systems thanks to its flexible branching model, which supports continuous development. In this article we will look at the main types of version control systems, with a particular focus on Git and on the Gitflow workflow, a methodology that makes continuous software development easier.

The main types of VCS

Centralized Version Control Systems (CVCSs)

Centralised version control systems (CVCSs) have a single server that contains all the versioned files. The various clients fetch the files from this server. However, the main flaw of this architecture is the risk associated with the centralised server: if the server is damaged or unavailable, you risk losing the entire project and its history, especially if there are no backups.

Distributed Version Control Systems (DVCSs)

In distributed version control systems (DVCSs), every client creates a complete copy of the repository, including its history. As a result, every clone is a real backup of all the data. Git, one of the best-known DVCSs, stands out for its branching model, which allows several teams to work at the same time on different parts of the project.

Git’s branching model

Git is an open source versioning system known for its advanced branching model. This model encourages the creation of independent local branches, favouring simultaneous development by different teams. Git is based on two main branches:

  • MASTER/MAIN: the branch dedicated to production.
  • DEVELOP: the development branch where tests are run and the individual development branches for new features are merged.

At the heart of Git is a feature-based workflow, which promotes the creation of a new branch for every new feature being worked on. This makes switching between branches easy, allowing you to move from one to another without problems. Once the development of a feature is finished, the development branch is removed by merging it into the official development and test branch (DEVELOP). When you want to go to production, everything is merged into MASTER/MAIN.

Gitflow: Supporting continuous software development

What is Gitflow?

Gitflow, originally published by Vincent Driessen, is a Git workflow that helps with continuous software development. This method defines a branching model geared to scheduled, cyclical projects, keeping Git’s basic standards but assigning specific roles to different types of branch according to their purpose.

Commands introduced by Gitflow

Gitflow commands are groupings of basic Git commands that make branch management easier:

sh

Copy code

git flow release finish 1.2.0 git checkout master git merge –no-ff release/1.2.0 git tag -a 1.2.0 git checkout develop git merge –no-ff release/1.2.0 git branch -d release/1.2.0

Branches and their purpose

  • Feature Branch: It originates from DEVELOP and, once finished, is merged back into it. Used for the parallel development of new features.
  • Release Branch: It originates from DEVELOP and contains a set of features ready to be tested and published. It is merged into MASTER/MAIN and DEVELOP once it is ready for production.
  • Hotfix Branch: It originates from MASTER/MAIN and is used for quick fixes of bugs present in production. It is merged into MASTER/MAIN and DEVELOP after the fix.

The golden rules of Gitflow

  1. A develop branch is created from master/main.
  2. A release branch is created from develop.
  3. feature branches are created from develop.
  4. When a feature is complete, it is merged into develop.
  5. When the release branch is ready, it is merged into develop and master/main.
  6. If a problem is detected in master/main, a hotfix branch is created from master.
  7. Once the hotfix is complete, it is merged into both develop and master/main.

Adopting a workflow like Gitflow is fundamental for any organisation that aims to excel in its sector. dotenv has integrated this methodology into its daily processes, thereby ensuring high standards of efficiency, professionalism and client satisfaction. Thanks to Gitflow, we can manage complex projects with ease, maintaining quality and consistency at every stage of development.

Contact us now to develop your idea!

If these topics interest you, we also talk about them out loud.

Nessun Segnale is dotenv’s podcast: 41 episodes, with guests who build software and products.