Git log to Mermaid gitGraph converter
Paste the output of one git log command and get a Mermaid gitGraph with your branches, merges and tags. Free, and your history stays in your browser.
gitGraph
commit id: "a1b2c3d"
commit id: "b2c3d4e"
branch feature/login
commit id: "d4e5f6a"
checkout main
commit id: "e5f6a7b" tag: "v1.0"
merge feature/login id: "a7b8c9d" How to do it
- Step 1
Run one command
Run the git log command shown above the input in your repository.
- Step 2
Paste the output
Paste its output into the box.
- Step 3
Set the options
Choose hash or hash-and-message labels and how many commits to show.
- Step 4
Use it
Copy the Mermaid, or open it in the editor to export it.
Why draw your history
A gitGraph is the clearest way to explain a branching strategy, a release process, or what went wrong in a messy merge. Generating it from the real history means the picture matches what actually happened.
How branches are rebuilt
Mermaid's gitGraph can only start a branch from the current tip of another branch. The converter opens each branch right after the commit it forks from, so the diagram keeps the true fork points.
What this does not do
- Branches are inferred from the history, because git does not record which branch a commit was made on.
- If a merged branch kept going after the merge point, the merge is drawn from the branch's latest commit.
- Octopus merges show only one merged branch.
Frequently asked questions
Which git command do I run?
Run git log --all --topo-order --reverse --pretty=format:'%h|%p|%D|%s' in your repository and paste the output. It lists each commit with its parents, branch and tag names, and message, oldest first, which is what the converter needs to rebuild the branches.
How are commits assigned to branches?
Git does not record which branch a commit was made on, only parent links. The converter walks back from each branch tip along first parents, starting with main or master, and gives each commit to the first branch that reaches it. Commits from branches deleted after merging are named branch-1, branch-2 and so on.
Why are only some commits shown?
Large histories are cut to the newest commits (80 by default, up to 300) because a gitGraph with hundreds of commits is too long to read. Narrow the log with a range, such as main~50..HEAD, or a date with --since, to choose the part you want.
What about octopus merges?
Mermaid's gitGraph can only draw two-parent merges, so an octopus merge shows one of its merged branches, and the notes say which commits were affected.
More Mermaid tools
All tools- SQL to ER diagram
Paste SQL CREATE TABLE statements and get a Mermaid entity relationship diagram with every table, column, primary key, foreign key and relationship.
- JSON to Mermaid
Paste JSON or YAML and get a Mermaid mind map or flowchart of its structure: every object, list and value as a node.
- CSV to Mermaid
Paste CSV and turn it into a Mermaid pie chart, bar or line chart, or Gantt chart.