Last week I stumbled over a twitter thread of people argumenting about what Git workflow to use. Most common sense was, not to use Gitflow anymore. But how should our Git workflow be today?
My experience with Gitflow
Looking back in time, about 6 years ago, we started our first projects with Git as version control system. With day-to-day experience in team foundation version control (TFVS) and subversion (SVN), we started to adopt Git and Gitflow. At that time, Gitflow was the de facto standard workflow. Beside learning to adopt a new version control system, we also adopted a new workflow. Coming from trunk-based development – without branching – it became a very steep learning curve. Learning Git was feasible for a developer with experience in another version control system, but at the same time adopting a new workflow made the switch hard. I can remember that we had constant team discussions about how to branch, to be compliant with the Gitflow. And even worse, we tried to couple staging environments with our branches (dev -> DEV, test/release -> UAT, main -> PROD) to do something that we thought is continuous delivery.
All together lead to:
- Cognitive complexity: A lot of time in the team was invested in how to branch.
- Staleness of the main branch: As our production environment was coupled to the main branch, the merge from dev to main could only be made after user acceptance testing and so it (often) became stale. The dev branch became the most important one.
With this experience, we finally switched to a trunk-based development workflow with release branches, that eliminated the complexity and staleness of the main branch.
My current recommendation
Keep it simple. Start with a trunk-based workflow, like GitHub flow and from there think about how you want to do deliver your application. If you want to do continuous deployment your mostly done. If you have larger release cycles or have to support multiple versions, use release branches.
Gitflow Workflow | Atlassian Git Tutorial
Git Flow Is A Bad Idea – YouTube