--:--

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, and feature/hot-fix.

  • main is the primary branch, usually managed when changes are merged from develop. A production or release branch can be added per version.

  • develop is 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 onto develop before merging after code review.

  • hot-fix branches are used when production has a serious bug. After the fix is done, it gets merged back into both main and develop.

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 main branch plus feature and hot-fix branches, and everyone works around main.

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, and production/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.