何时使用
Use a Git 图 when…
01
Branching strategy explainers
02
Onboarding new contributors
03
Documenting a release process
语法基础
The minimal syntax
Copy this and you have a working git 图. 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/seo常见写法
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.
常见坑点
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.
相关图表