What is Gitflow?
How to get started with it
Spanish version here!
In early 2010, Vincent Driessen wrote an article titled “A successful Git branching model”, in which he advised using git branches in your development cycle using a method known as git-flow. The goal was to standardize branching and merging while building features, handling releases, and managing hot fixes in order to be consistent and reap the benefits of Git’s ‘branchy’ development model. Using many independent branches in Git provides a lot of flexibility, but it may be difficult.
In this article we’re going to cover:
- 1. What is Gitflow?
- 2. Key Branches in Gitflow
- 3. The Gitflow Workflow
- 4. Git Commands in Gitflow
- 5. Benefits of Gitflow
- 6. Drawbacks of Gitflow
- 7. Gitflow Tools
- 8. When to Use Gitflow
- 9. When Not to Use Gitflow
- 10. Gitflow in Data Engineering
Are you ready? Here we go!
1. What is Gitflow?
Gitflow is a branching model for Git that provides a structured approach to software development. It defines specific branches for different purposes and outlines how they should interact. The goal is to streamline the development process, manage releases effectively, and facilitate collaboration among team members.
2. Key Branches in Gitflow

Gitflow uses several long-lived and short-lived branches:
main (or master):
- This is the primary branch that represents the production-ready code.
- It should always be in a stable and releasable state.
- Only release branches are merged into main.
develop:
- This is the integration branch for all feature development.
- It’s where feature branches are merged after they’re completed.
- It’s a stable branch, but it might contain features that are not yet ready for release.
feature/*:
- These are short-lived branches created for developing specific features.
- They branch off from develop and are merged back into develop when the feature is complete.
- Each feature branch should focus on a single feature.
release/*:
- These are short-lived branches created for preparing a release.
- They branch off from develop and are merged into both main and develop when the release is complete.
- Release branches are used for final testing and bug fixes before a release.
hotfix/*:
- These are short-lived branches created for fixing critical bugs in production.
- They branch off from main and are merged into both main and develop when the hotfix is complete.
- Hotfix branches are used for urgent fixes that cannot wait for the next release.
3. The Gitflow Workflow
Here’s a step-by-step breakdown of the Gitflow workflow:
Initialization:
- The main branch is created (usually from the initial commit).
- The develop branch is created from main.
Feature Development:
- A new feature branch (feature/my-new-feature) is created from develop.
- Developers work on the feature in the feature branch, committing changes regularly.
- When the feature is complete, the feature branch is merged back into develop.
Release Preparation:
- When develop is ready for a release, a new release branch (release/1.0.0) is created from develop.
- The release branch is used for final testing and bug fixes.
- No new features should be added to the release branch.
Release:
- When the release is ready, the release branch is merged into main.
- The merge commit on main is tagged with the release version (e.g., v1.0.0).
- The release branch is also merged back into develop.
Hotfix:
- If a critical bug is found in production, a hotfix branch (hotfix/fix-critical-bug) is created from main.
- The bug is fixed in the hotfix branch.
- The hotfix branch is merged into both main and develop.
- The merge commit on main is tagged with the hotfix version (e.g., v1.0.1).
4. Git Commands in Gitflow
Here are the Git commands you’d typically use in a Gitflow workflow:
Initialization:
git init # if starting a new repo
git branch develop
git checkout develop
Feature Development:
git checkout -b feature/my-new-feature develop
git add .
git commit -m "Add my new feature"
git checkout develop
git merge - no-ff feature/my-new-feature # using - no-ff to preserve the feature branch history
git branch -d feature/my-new-feature # delete the feature branch
Release Preparation:
git checkout -b release/1.0.0 develop
git add .
git commit -m "Prepare for release 1.0.0"
Release:
git checkout main
git merge - no-ff release/1.0.0
git tag -a v1.0.0 -m "Release 1.0.0"
git checkout develop
git merge - no-ff release/1.0.0
git branch -d release/1.0.0
Hotfix:
git checkout -b hotfix/fix-critical-bug main
git add .
git commit -m "Fix critical bug"
git checkout main
git merge - no-ff hotfix/fix-critical-bug
git tag -a v1.0.1 -m "Hotfix 1.0.1"
git checkout develop
git merge - no-ff hotfix/fix-critical-bug
git branch -d hotfix/fix-critical-bug
5. Benefits of Gitflow
- Structured Workflow: Provides a clear and consistent workflow for development and releases.
- Clear Branching Strategy: Makes it easy to understand the purpose of each branch.
- Release Management: Simplifies the process of preparing and releasing software.
- Hotfix Management: Provides a clear process for handling critical bugs in production.
- Collaboration: Facilitates collaboration among team members by providing a well-defined process.
6. Drawbacks of Gitflow
- Complexity: Can be more complex than simpler branching models, especially for smaller teams.
- Overhead: Requires more branches and more merging, which can add overhead.
- Not Ideal for Continuous Delivery: May not be the best fit for teams that practice continuous delivery, where releases are frequent and automated.
7. Gitflow Tools
There are some tools that can help simplify Gitflow:
- Gitflow Extension: A command-line extension that provides commands for managing Gitflow branches (e.g., git flow init, git flow feature start, git flow release start).

- SourceTree: A GUI Git client that has built-in support for Gitflow.

- GitKraken: Another GUI Git client with Gitflow support.

8. When to Use Gitflow
Gitflow is a good choice for projects that:
- Have structured release cycles.
- Require a clear separation between development and production.
- Have a team of multiple developers.
- Need a well-defined process for handling hotfixes.
9. When Not to Use Gitflow
Gitflow may not be the best choice for projects that:
- Practice continuous delivery.
- Have a small team.
- Require a simpler branching model.
- Release very frequently.
10. Gitflow in Data Engineering
In data engineering, Gitflow can be used to manage:
- ETL scripts and data pipelines.
- Data models and schemas.
- Configuration files for data infrastructure.
- Machine learning models.
The same principles apply: feature branches for new functionality, release branches for preparing deployments, and hotfix branches for critical bug fixes.
In Summary
Gitflow is a powerful branching model that can help teams manage complex software projects. It provides a structured workflow, clear branching strategy, and effective release management. However, it’s important to consider the complexity and overhead before adopting Gitflow. If your project fits the criteria, Gitflow can be a valuable tool for improving your development process.
Thank you for Reading. How About More Articles?
Do you want more?

Hit 50 times that 👏 button and comment if you want me to write more how to get started articles.
- Follow David Regalado for more educational content and stuff!