Understanding Different Git Workflows: GitFlow, GitHubFlow, GitLabFlow, and Trunk-Based Development

Matías Salinas
3 min readMar 25, 2023

--

Git is a widely used version control system in software development that enables developers to collaborate on projects, track changes, and manage code revisions. However, when managing a large codebase with multiple contributors, it can be challenging. To address this challenge, different Git workflows have been developed to help teams manage their code more effectively. We will discuss four different Git workflows — GitFlow, GitHubFlow, GitLabFlow, and Trunk-Based Development — and explain their stages, branches, and other details.

GitFlow Workflow

GitFlow is a popular branching model developed by Vincent Driessen. It is a strict branching model that defines a standard set of branches and their purpose. The GitFlow workflow consists of the following branches:

  • Master branch: This branch contains the production-ready code. It is only updated when a new release is made.
  • Develop branch: This branch contains the latest development changes. It is the main branch where all new features and bug fixes are merged.
  • Feature branch: This branch is created for each new feature or bug fix. All changes related to a particular feature or bug fix are made in this branch.
  • Release branch: This branch is created when a new release is about to be made. All final bug fixes and changes are made in this branch.
  • Hotfix branch: This branch is created to fix critical bugs in the production code.

GitHubFlow Workflow

GitHubFlow is a simple and flexible workflow that is widely used in open-source projects. It consists of the following branches:

  • Master branch: This branch contains the production-ready code. All changes that are merged into this branch are automatically deployed.
  • Feature branch: This branch is created for each new feature or bug fix. All changes related to a particular feature or bug fix are made in this branch.

The GitHubFlow workflow is based on the principle of continuous deployment, where changes are deployed to production as soon as they are merged into the master branch.

GitLabFlow Workflow

GitLabFlow is similar to GitFlow but is more flexible and easier to use. It consists of the following branches:

  • Master branch: This branch contains the production-ready code.
  • Develop branch: This branch contains the latest development changes.
  • Feature branch: This branch is created for each new feature or bug fix. All changes related to a particular feature or bug fix are made in this branch.
  • Release branch: This branch is created when a new release is about to be made. All final bug fixes and changes are made in this branch.
  • Hotfix branch: This branch is created to fix critical bugs in the production code.

The GitLabFlow workflow allows developers to work on multiple features simultaneously and makes it easier to merge changes.

Trunk-Based Development Workflow

Trunk-Based Development is a workflow that is centered around the use of a single branch, the trunk or main branch. It consists of the following stages:

  • Develop: All new features and bug fixes are made directly on the trunk branch.
  • Verify: Code changes are continuously integrated and tested to ensure that they don’t break the build.
  • Release: When the code is ready for release, it is tagged and deployed to production.

The Trunk-Based Development workflow allows for faster feedback and quicker time-to-market by eliminating the need for feature branches.

In conclusion, choosing the right Git workflow is crucial for managing code in a collaborative environment. GitFlow, GitHubFlow, GitLabFlow, and Trunk-Based Development are some of the most popular Git workflows. Understanding their stages, branches, and other details can help teams choose the best workflow for their project.

--

--

Matías Salinas
Matías Salinas

No responses yet