1.7K Views

GIT108 - Git Workflow Models

Learn the most popular Git workflow strategies used by modern development teams to organize collaboration and code delivery.

Different teams use different Git workflows depending on project size, release cycles, and collaboration needs.
In this chapter, we explore three widely used Git workflow models: Feature Branch Workflow, Git Flow, and Trunk-Based Development.

Understanding these models will help you choose the right strategy for your own projects.

1. Feature Branch Workflow

Feature Branch Workflow is one of the simplest and most popular Git strategies.
Each new feature or fix is developed inside its own branch, separate from main.

How it works

  1. Create a new branch for each feature:
git checkout -b feature/new-ui
  1. Work and commit changes on the feature branch
  2. Merge the branch into main when done:
git checkout main
git merge feature/new-ui

Benefits

  • Keeps main clean and stable
  • Easy to review changes via pull requests
  • Ideal for small to medium teams

Common branch names

  • feature/login
  • feature/user-profile
  • feature/checkout

2. Git Flow Workflow

Git Flow is a more structured workflow used by larger teams or projects with scheduled releases.
It introduces multiple long-living branches with specific responsibilities.

Main branches

  • main = production code
  • develop = integration branch

Supporting branches

  • feature/*
  • release/*
  • hotfix/*

Example: creating a feature branch

git checkout develop
git checkout -b feature/payment-integration

Example: starting a release branch

git checkout develop
git checkout -b release/1.2.0

Pros

  • Ideal for complex products
  • Clear separation of work stages
  • Supports planned release cycles

Cons

  • Too heavy for small teams
  • Lots of branching and merging
  • Harder to maintain for fast-moving products

3. Trunk-Based Development

Trunk-Based Development is a fast and modern workflow where developers work directly on main or short-lived branches.

Key characteristics

  • Developers commit small changes frequently
  • Branches live for only hours or a few days
  • Continuous Integration (CI) tests every commit
  • Encourages rapid delivery and early feedback

Example: creating a short-lived branch

git checkout -b fix/typo

Commit quickly and merge back into main:

git checkout main
git merge fix/typo

Best used when

  • Team releases often
  • Code must stay deployable at all times
  • Strong CI practices exist

Comparison Table

Feature Branch = Simple and great for small teams
Git Flow = Structured and ideal for large projects
Trunk-Based = Fast and CI-driven development


Choosing the Right Workflow

Choose Feature Branch Workflow if your team wants a clean, easy-to-understand approach.

Choose Git Flow if you have formal release cycles or a large team working on complex product phases.

Choose Trunk-Based Development if you deploy often and use strong CI practices.

There is no “one-size-fits-all” approach — choose what fits your project and team culture.


Summary

In this chapter, you learned:

  • The three major Git workflow models
  • How Feature Branching works
  • How Git Flow organizes large teams
  • How Trunk-Based Development supports rapid delivery
  • When to use each workflow

Next, we’ll explore rewriting Git history using amend, rebase, and stash — powerful tools for keeping your commit history clean.