gitGraphv0.9.4
What is a Git graph diagram?
Branches, merges, tags — exactly as in your repo.
gitGraph
When to use it
Use a Git graph when…
01
Branching strategy explainers
02
Onboarding new contributors
03
Documenting a release process
Syntax basics
The minimal syntax
Copy this and you have a working git graph. Build from here.
gitgraph.mmd
gitGraph
commit
commit
branch feat/i18n
commit
commit
checkout main
merge feat/i18n
branch feat/seo
commit
commit
checkout main
merge feat/seoCommon patterns
Patterns worth memorizing
Tags
`commit tag: "v1.0.0"` adds a label to a commit dot.
Cherry-pick
`cherry-pick id: "<hash>"` reproduces a commit on the current branch.
showCommitId
Set `showCommitId: false` in init to hide the auto-generated short SHAs.
Common gotchas
The things that will trip you up
Mermaid silently ignores misspellings — these are the failures we see most.
- 01
Branch order in the legend follows declaration order, not visual order.
- 02
You must `checkout` before committing on a branch — there is no implicit current branch.
- 03
Mainline rebase isn't modeled; document linear history with `commit` instead.
Related diagram types