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
- Create a new branch for each feature:
git checkout -b feature/new-ui- Work and commit changes on the feature branch
- Merge the branch into main when done:
git checkout main
git merge feature/new-uiBenefits
- 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-integrationExample: starting a release branch
git checkout develop
git checkout -b release/1.2.0Pros
- 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/typoCommit quickly and merge back into main:
git checkout main
git merge fix/typoBest 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.