Since we often work with Git, it is safe to assume that most people are familiar with Git concepts such as branches and commands like checkout, merge, rebase, and revert.
When developing a new feature, we usually checkout from the current branch to another branch to work on it. In a team environment, multiple people may be developing multiple features, each on their own branch, allowing for independent and parallel development. Everything would be perfect if one day, when merging branches together, there were no conflicts.
Gitflow was created to define rules for branching and feature development, as well as product releases. It is a workflow for working with Git that is most convenient for developers.
Gitflow is a concept that defines branching and coordination for developing and releasing features using Git.
Gitflow can be customized by development teams based on their environment and requirements. It can be either created from scratch or based on an existing workflow.
There are many variations of Gitflow, but the most famous one is based on Vincent Driessen's branching model.
In Vincent Driessen's Gitflow, the workflow is as follows:
As you can see, with this Gitflow model, we need at least three environments for running code: production, staging, and develop, corresponding to the master, release, and develop branches, respectively. However, in practice, it is not necessary to have all three environments. We can customize Gitflow to suit our project's needs and optimize it for efficiency.
The Gitflow based on Vincent Driessen's model can be complex and may slow down the development process or result in a high number of code conflicts. However, it provides clear and distinct branches, and it is easy to establish multiple environments (develop, staging, production).
For example, we can have just the develop and production environments but still ensure that feature development branches are checked out from develop and merged into master before going into production.
Apart from the flows mentioned above, there are other Gitflows as well. In fact, both GitHub and Gitlab have proposed Gitflows for working on their platforms. If time allows, I will write another article discussing the Gitflows proposed by these two industry giants.
In this article, I have presented the concept of Gitflow along with the Gitflow model based on Vincent Driessen's branching diagram. Gitflow was created to address the challenges of working in teams by providing a convenient and conflict-free workflow. Gitflow is also a characteristic of a software development team. If you are using any Gitflow, feel free to share it with others!
5 profound lessons
Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!
Subscribe to receive new article notifications
Hello, my name is Hoai - a developer who tells stories through writing ✍️ and creating products 🚀. With many years of programming experience, I have contributed to various products that bring value to users at my workplace as well as to myself. My hobbies include reading, writing, and researching... I created this blog with the mission of delivering quality articles to the readers of 2coffee.dev.Follow me through these channels LinkedIn, Facebook, Instagram, Telegram.
Comments (1)