Hands-on Demo – All Git Branch Models for Continuous Delivery
Below is a summary of four commonly used Git branching models for Continuous Delivery (CD): GitHub Flow, GitFlow, Release Branching, and Trunk-Based Development (TBD). Each model is explained with an example workflow.
1. GitHub Flow
Key Features:
Simplified model with only
mainand feature branches.Merges into
mainare production-ready.Best for teams practicing Continuous Deployment.
Workflow:
Feature Development:
Create a short-lived feature branch from
main.Example:
xxxxxxxxxx51git checkout -b feature/add-login-page23# Make changes4git commit -m "Add login page"5git push origin feature/add-login-pagePull Request: Open a PR, review changes, and merge into
main.Automated Deployment: CI/CD automatically deploys the
mainbranch to production.
Advantages:
Simplicity and speed.
Easy to use for smaller teams.
Challenges:
Limited support for long-term versions or multiple environments.
2. GitFlow
Key Features:
Structured branching with
main,develop,feature/,release/, andhotfix/branches.Supports long-term development and versioning.
Best for projects requiring multiple releases and environments.
Workflow:
Feature Development:
Develop features on
feature/branches based ondevelop.xxxxxxxxxx51git checkout -b feature/add-login-page develop23# Make changes4git commit -m "Add login page"5git push origin feature/add-login-pageMerge into
developonce complete.
Create a Release:
Create a
release/branch fromdevelop.xxxxxxxxxx51git checkout -b release/v1.0.0 develop23# Update version4git commit -m "Prepare release v1.0.0"5git push origin release/v1.0.0Finalize and merge into both
mainanddevelop.
Hotfix: Use
hotfix/for urgent production issues.
Advantages:
Robust version control for complex projects.
Clear separation of development, release, and production code.
Challenges:
High overhead for smaller teams.
3. Release Branching
Key Features:
Maintains multiple active releases using
release/branches.Supports long-term versions and backports.
Best for projects with strict release schedules or LTS versions.
Workflow:
Create a Release:
Create a
release/branch fromdevelopormain.
xxxxxxxxxx41git checkout -b release/v1.0.0 develop2# Update version3git commit -m "Release v1.0.0"4git push origin release/v1.0.0Stabilize and Deploy:
Apply bug fixes directly to the
release/branch.Merge into
mainfor deployment.
Hotfix:
Create
hotfix/branches frommainfor urgent fixes.
Advantages:
Easy to manage multiple release versions.
Clear support for LTS or patch releases.
Challenges:
Additional complexity due to multiple active branches.
4. Trunk-Based Development
Key Features:
A single
mainbranch with short-lived feature branches.Requires robust CI/CD to maintain stability.
Best for teams practicing Continuous Deployment.
Workflow:
Direct Commit to
main: For small changes:xxxxxxxxxx41git checkout main2# Make changes3git commit -m "Small fix"4git push origin mainShort-Lived Feature Branches: For larger changes:
xxxxxxxxxx71git checkout -b add-login-page2# Make changes3git commit -m "Add login page"4git push origin add-login-page5git checkout main6git merge add-login-page7git push origin mainAutomated CI/CD: Deploys every commit to
mainautomatically.
Advantages:
Fast delivery with minimal branching overhead.
Encourages frequent and incremental updates.
Challenges:
Requires strong CI/CD practices and discipline.
Comparison of Branching Models
| Feature | GitHub Flow | GitFlow | Release Branching | Trunk-Based Development |
|---|---|---|---|---|
| Branch Complexity | Simple | Complex | Moderate | Minimal |
| Ideal Team Size | Small to medium | Medium to large | Medium to large | Any |
| Release Management | Limited | Robust | Strong | Minimal |
| Deployment Frequency | High | Moderate | Moderate | High |
| CI/CD Dependency | Strong | Moderate | Moderate | Strong |
| Use Case | Rapid deployment | Complex projects | Multiple releases | Continuous Deployment |
Choosing the Right Model
GitHub Flow: For small teams focused on speed and simplicity.
GitFlow: For teams managing complex, long-term projects with multiple environments.
Release Branching: For projects needing strong version control and long-term support.
Trunk-Based Development: For fast-moving teams practicing Continuous Deployment.






















Leave a Reply