Git Branching Strategy — Mermaid Flowchart
Flowchart documenting a Git branching strategy with main, develop, feature, release, and hotfix branches.
What this diagram shows
This Mermaid flowchart is GitFlow drawn left to right. main can sprout a hotfix that merges back to main and to develop, and a tag on main is what production deploys. develop sprouts feature branches for auth, search, and the dashboard. Each feature returns through a pull request. develop then opens release/v2.1, which may loop for QA fixes, then merges to main and back to develop. Node colors mark main green, develop blue, and production red.
Use it when a team is choosing GitFlow and people disagree about where a hotfix lands. The hotfix merges to main and to develop, not only to main, or the next release branch will resurrect the bug. The release branch merges both ways for the same reason. Feature branches never touch main.
The style lines at the bottom are Mermaid class styling on three nodes. They do not change the topology. Production is a deploy node, not a branch.
Mermaid syntax in this template
flowchart LR. Branch nodes are rectangles. Edge labels say merge, tag, or PR. style statements color main, develop, and the deploy node.
HF -->|merge + tag| MainOne edge carries both the merge and the tag. The other hotfix edge is merge into develop, without a tag.
F1 -->|PR + review| DevFeatures rejoin develop only. There is no edge from a feature to main.
Rel -->|QA + fixes| RelA self-edge. The release branch can take more than one fix commit before it merges.
style Main fill:#22c55e,color:#000Colors the main node. fill is the background. color is the text. The hex values are inline, not a theme.
Variations and ways to customize it
Draw trunk-based instead
Delete develop and point feature PRs at main. Keep the hotfix only if you still patch release tags. The release branch goes away if you deploy main continuously.
F1[feature/user-auth] -->|PR + review| Main[main]
Main -->|tag release| Prod[Production Deploy]Name the protected branches
If main is called production and develop is called main, rename the labels and keep the edges. A rename without moving the hotfix edges is how teams document a policy they do not follow.
Show a failed review
The PR edges only show the success path. A second label back to the feature node is the changes-requested loop.
Dev -->|changes requested| F1[feature/user-auth]Diagram type
FlowchartTags
Frequently asked questions
Where does a hotfix merge?
To main, with a tag, and to develop, without a tag. Production deploys from the tag on main. Skipping the develop merge means the next release branch can ship the bug again.
Do feature branches merge to main?
No. They merge to develop through a pull request. main receives the release branch and hotfixes only.
What is the self-loop on the release branch?
QA fixes committed on release/v2.1 before it merges. The loop is Rel to Rel. After that, one edge goes to main and one returns to develop.
How is this different from the git graph template?
This is a policy flowchart: which branch type may merge where. The git graph template is a picture of actual commits, including two feature branches and a v1.1.0 tag.
Related templates and guides
All Documentation templatesGit Feature Branch Workflow
Git graph showing a feature branch workflow with parallel development, code review, and release tagging.
REST API Architecture
Flowchart documenting a REST API architecture with middleware layers, controllers, services, and data access.
Error Handling Strategy
Flowchart documenting an application's error handling strategy with retry logic, fallbacks, and alerting.
Mermaid flowchart syntax
Labeled merges and node styling used to color main and develop.
Flowchart syntax guide
Self-edges and style lines if you add a changes-requested loop.