Branching strategy is one of those topics that’s easy to argue about and hard to explain—until you draw it.
Mermaid’s GitGraph diagrams are perfect for documenting:
- trunk-based vs GitFlow
- release branches
- hotfixes
- cherry-picks
- backports
- tagging releases
And unlike screenshots from a slide deck, Mermaid diagrams live right next to your engineering docs and can evolve as your process evolves.
This post focuses on practical release/branch patterns, with copy/paste diagrams you can adapt.
A quick refresher
GitGraph diagrams start with gitGraph and then you describe commits, branches, checkouts, merges, and tags.
Mermaid’s GitGraph syntax has evolved over time; if a snippet doesn’t render in your setup, the structure is still useful as a reference for adjusting to your renderer’s supported syntax.
The smallest example
Source
|
1 2 3 4 5 6 7 8 9 10 11 |
gitGraph commit commit branch feature/login checkout feature/login commit commit checkout main merge feature/login commit |
Rendered
1) Trunk-based development (the “default” for many teams)
Trunk-based usually means:
- short-lived branches
- frequent merges to
main - feature flags for incomplete work
- releases from
main
Trunk-based with a short-lived feature branch
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
gitGraph commit id:"init" commit id:"baseline" branch "feature/search" checkout "feature/search" commit id:"add search endpoint" commit id:"wire UI" checkout main merge "feature/search" commit id:"cleanup" tag:"v1.4.0" |
Rendered
When trunk-based goes wrong
Common failure modes:
- long-lived feature branches (merge pain)
- “release day” merges (risk spike)
- no feature flags (incomplete work leaks)
GitGraph diagrams are a nice way to show what you want to avoid.
2) Release branches (stabilize without freezing main)
A release branch lets you stabilize while main keeps moving.
Release branch + patch releases
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
gitGraph commit id:"v2 work starts" commit id:"feature A" commit id:"feature B" branch "release/2.0" checkout "release/2.0" commit id:"rc fixes" tag:"v2.0.0" commit id:"security patch" tag:"v2.0.1" checkout main commit id:"feature C" |
Rendered
Tip: Keep release branches short-lived. If they live forever, you’re maintaining two trunks.
3) Hotfixes (production is on fire)
Hotfixes usually start from the last production tag and get merged forward.
Hotfix branch from a production tag
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 |
gitGraph commit id:"v1.9 prep" commit id:"release" tag:"v1.9.0" branch "hotfix/1.9.1" checkout "hotfix/1.9.1" commit id:"fix null pointer" tag:"v1.9.1" checkout main merge "hotfix/1.9.1" commit id:"post-hotfix cleanup" |
Rendered
A note on “merge forward”
If you hotfix production but forget to merge forward into main, you’ll reintroduce the bug later.
A GitGraph diagram makes that rule visual.
4) Backports and cherry-picks (supporting multiple versions)
If you maintain multiple supported versions, you’ll likely need backports.
Backport a fix to an older release branch
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
gitGraph commit id:"main work" commit id:"feature X" branch "release/1.8" checkout "release/1.8" commit id:"1.8 maintenance" tag:"v1.8.0" checkout main commit id:"fix security issue" checkout "release/1.8" commit id:"backport security fix" tag:"v1.8.1" |
Rendered
Tip: If you backport regularly, write down the policy: which fixes qualify, how long you support old branches, and who approves.
5) GitFlow (feature + develop + release + hotfix)
GitFlow is heavier than trunk-based, but some teams still use it successfully—especially with longer release cycles.
A GitFlow-shaped diagram
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
gitGraph commit id:"init" branch develop checkout develop commit id:"dev baseline" branch "feature/payments" checkout "feature/payments" commit id:"feature work" commit id:"more feature work" checkout develop merge "feature/payments" branch "release/3.0" checkout "release/3.0" commit id:"stabilize" tag:"v3.0.0" checkout main merge "release/3.0" checkout develop merge "release/3.0" |
Rendered
The GitFlow footgun
If you don’t merge the release branch back into develop, the divergence grows and you’ll get surprise conflicts.
6) A “release playbook” diagram (staged rollout + tags)
This pattern is useful when you tag releases, then deploy to environments in order.
Source
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
gitGraph commit id:"feature complete" commit id:"rc build" tag:"v4.2.0-rc1" commit id:"rc fixes" tag:"v4.2.0" branch "deploy/staging" checkout "deploy/staging" commit id:"deploy staging" checkout main branch "deploy/prod" checkout "deploy/prod" commit id:"deploy prod" |
Rendered
In many orgs, the “deploy branches” are more conceptual than literal. If you don’t use them, keep the diagram focused on tags and environments.
7) Common gotchas (and fixes)
Gotcha: diagrams become too detailed
Fix: keep GitGraph diagrams narrative-level. You’re documenting the strategy, not every commit.
Gotcha: branch names don’t match reality
Fix: mirror your actual conventions: release/x.y, hotfix/x.y.z, feature/<name>.
Gotcha: unclear ownership
Fix: add a short section in the post:
- who cuts release branches
- who approves hotfixes
- who tags releases
8) A blog-ready checklist
Before you publish:
- Choose one strategy per post (or clearly compare two).
- Keep to 10–20 commits.
- Use tags to mark releases (
v1.2.3). - Show the “merge forward” rule for hotfixes.
- If you support multiple versions, show a backport example.
Where to go next
If GitGraph clicks for you, the next Mermaid diagram type that complements release strategy is sequence diagrams for your CI/CD pipeline (build → test → deploy → verify), or flowcharts for release checklists and go/no-go decisions.




