What Is Gitflow and Why Should You Use It?
For those of you who are not yet familiar with Git, Gitflow or version control systems (VCSs) in general, these are comprehensive technical solutions to manage changes in our source repositories — which can be thought of as source code databases.
Version control systems are indispensable to modern development, as they enable programmers to gain access to source code files, modify and launch them from a single centralised location.
More importantly, however, they are the starting point for understanding Git and the outstanding Gitflow workflow.
Why Is Git Used?
In development teams today — among other VCSs such as Mercurial, SVN and CVS — Git has become a de facto standard, as we are able to work collectively with the source code and other artefacts, and push our changes back to the team repository as soon as we are done with our work. This does not mean, however, that Git is not without its unique challenges.
For example, without the appropriate workflow in place, developers may find themselves in an infinite loop of impending difficulties, as they struggle to fix code defects each time that the production code is changed.
What Is Gitflow?
To solve this problem, developer Vincent Driessen created the Gitflow branching model, a particularly useful framework for streamlining collaboration and scaling teams. Essentially, Gitflow gives us a set of rules for how to work with individual Git branches by assigning specific roles and defining how they interact. Because it was developed with the project release in mind, it varies widely from project to project and should ideally mirror your own development needs.
Gitflow’s main distinguishing factor is that instead of making use of a single master branch, it uses multiple branches running in parallel to record your project’s unique history.
While the master branch is fully tested and should at all times be production-ready, the develop branch is an integration branch for the project’s features, and it is also where all tests should be performed.
To understand this more clearly, however, take a look at our Gitflow overview below.
An Overview of the Gitflow Strategy
- A develop branch is created from master
- A release branch is created from develop
- Multiple feature branches are created from develop
- Completed features are merged into the develop branch
- Finished release branches are merged into the develop and then master branches
- When issues are found in the master branch, a hotfix branch is then created from it
The Perfect Git Branching Strategy for Agile
If you are feeling somewhat confused, consider Gitflow in an Agile context. Once we have completed all of our user stories, for instance, each feature branch may correspond to a unique software requirement. In this way, the entire development team can deal with individual project tasks while employing multiple repositories to simultaneously tackle different parts of the code. This greatly speeds up development, as it can masterfully coordinate our work.
Another fantastic way in which Gitflow integrates with Agile is in the area of code reviews. After all, with the help of pull requests, team members may be automatically notified that any branch is ready for quality checks.
Note that taking too long to merge feature branches may impair a team’s ability to quickly iterate, so it is worth taking the time to decompose one’s user stories and ensure that all of the feature branches are made up of smaller project tasks.
Is Gitflow for You?
In the end, Gitflow is yet another tool in SPG’s expansive development arsenal. With its help, we can efficiently coordinate work among prolific software developers, work on various project objectives including new functions, experimental features, research and QA & QC procedures, and fix defects working in parallel without affecting one another’s code.
The workflow is an extremely important improvement to any software development process, as it allows us to make safe changes to projects whilst supporting a reliable codebase.