DevOps
Git
Branching Strategies

Branching Strategies

In a professional environment, you don't just create branches randomly. Teams use Branching Models to ensure that production code remains stable while new features are being developed and tested.

1. Professional Branch Archetypes

Branch TypeName ConventionPurpose
Mainmain or masterThe Stable Core. Contains production-ready code only.
DevelopdevelopThe Integration Hub. Where features are combined and tested.
Featurefeat/login-apiThe Isolated Task. Used for building a specific new component.
Hotfixhotfix/v1.1.1The Emergency Room. Fast repairs to production code.
Releaserelease/v2.0The Launchpad. Preparation and minor polishing for a major release.

2. Common Industry Workflows

A. Gitflow (The Traditional Standard)

A strict, branch-heavy model best for projects with scheduled release cycles and multiple versions in production.

B. GitHub Flow (The SaaS Standard)

A simple, agile workflow designed for high-frequency deployments. If it's on main, it's live.

C. Trunk-Based Development (The DevOps Ideal)

Developers push small, frequent updates to a single "trunk" (main). It relies heavily on Feature Flags to hide incomplete work from users.


3. Picking the Right Strategy

StrategyComplexityTeam SizeBest For...
GitflowHighLargeEnterprise software, complex releases.
GitHub FlowLowSmall-MidSaaS, web apps, continuous delivery.
Trunk-BasedMediumAnyHighly automated teams, high velocity.

[!TIP] Protect Your Main Branch No matter which strategy you choose, the main branch should be "Protected". This ensures every change is reviewed via a Pull Request and passes all Automated Tests before it can be merged.