Git graphs: tags
简介 / Introduction
A tag is a permanent marker on a commit — v1.0, v2.0-rc1 and so on. In a Git history graph a tag usually shows up as a labelled node, telling the reader “this line is a release point”.
Both PlantUML’s gitgraph and Mermaid’s gitGraph can label commits and merges, but their syntax constraints differ: PlantUML accepts tag: on its own line, so a single node can carry several tags, while Mermaid only accepts one tag: suffix after a commit or merge and fails to parse a standalone tag line. This article walks through one release history — the initial commit tagged v0.9, the feature branch tagged v1.0-alpha, the merge back into main tagged v1.0 — in both engines.
PlantUML 版
In PlantUML, tag: may follow commit / merge, or stand on its own line:
1 | @startgitgraph |
PlantUML’s gitgraph lets tag: stand alone, so several tags can be stacked on one node: the final tag: "v1.0-rc1" line lands on the same commit as the merge, expressing the common “RC right before the final release” idea. tag: after commit behaves identically.
Mermaid 版
Mermaid’s gitGraph only supports tag: as a suffix of commit or merge, with at most one tag per node:
1 | gitGraph |
Note the difference: a standalone tag: "v1.0-rc1" line makes Mermaid fail with Parse error ... got 'COMMIT_TAG' — the grammar has no notion of a standalone tag statement. If one commit needs two tags, Mermaid offers no direct way to do it; you either split it into two commits or explain it in prose next to the diagram.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Diagram container | @startgitgraph / @endgitgraph |
gitGraph header, no closing marker |
| Tag syntax | tag: "v1.0" after commit/merge |
tag: "v1.0" after commit/merge |
| Standalone tag line | Supported — tag: "x" on its own line |
Not supported — parse error |
| Several tags on one node | Supported | Not supported — one tag per node |
| Branch / switch | branch / checkout |
branch / checkout |
| Tag placement | Attached to the commit or merge node | Same |
小结 / Wrap-up
A tag is the highest-density element in a Git history graph: it promotes a plain commit into a release point. Day-to-day usage is nearly identical across both engines — write tag: "v1.0" after a commit or merge and you are done. The real difference shows up at the edges. PlantUML’s gitgraph allows a standalone tag: line, which means one merge node can carry both v1.0 and v1.0-rc1; Mermaid’s gitGraph grammar is stricter and a standalone tag line breaks the entire diagram. When documenting a release process that needs parallel tags such as “final + RC”, PlantUML is the engine that can say it in one line.
- Title: Git graphs: tags
- Author: puml.online
- Created at : 2026-11-21 09:00:00
- Updated at : 2026-11-26 01:07:01
- Link: https://puml.online/blog/git-graph-tags-en/
- License: This work is licensed under CC BY-NC-SA 4.0.