Gitflow, Github flow, and Gitlab flow - Understanding Git Workflows
Question:
What are Gitflow, Github flow, and Gitlab flow, and how do they differ? (Testing teamwork ability with Git tools. Of course, when working on a shared project, being proficient with Git is essential.)
Answer:
Common Git workflows are Gitflow, Github flow, and Gitlab flow. I will call the main branch main for simplicity.
Gitflow:
-
This is the classic way to split a project into multiple branches. The main ones are
main/production/release,develop, andfeature/hot-fix. -
mainis the primary branch, usually managed when changes are merged fromdevelop. Aproductionorreleasebranch can be added per version. -
developis where the team works together. New features are merged here first, then deployed to staging for testing before they go to production. -
feature/branches are usually created for each new feature. Developers work there first, then rebase ontodevelopbefore merging after code review. -
hot-fixbranches are used when production has a serious bug. After the fix is done, it gets merged back into bothmainanddevelop.
Pros and Cons:
-
Clear environment separation and a more explicit workflow.
-
Becomes complex when there are many environments, and more branches usually means more merge conflicts. :D
-
CI/CD is harder to manage because you end up with separate branches for production and staging.
Github flow:
- This is faster than Gitflow. It usually has one
mainbranch plusfeatureandhot-fixbranches, and everyone works aroundmain.
Pros and Cons:
-
It cuts down the complexity of Gitflow, but after merging, changes usually go straight toward production instead of going through a separate staging phase.
-
Easier CI/CD because the flow stays centered around
main.
Gitlab flow:
-
This combines Gitflow and Github flow. The exact setup depends on the team’s standards, but it usually includes
main,feature,staging, andproduction/release. -
A flow can look like this:
feature -> main -> staging -> release
or
feature -> main -> release/1.0 -> production
Pros:
-
More flexible than the other two.
-
Good fit for CI/CD.
-
Clear separation between dev, staging, and production.