AI git graph generator
AI git graph generator that drafts branches, commits and merges as a Mermaid gitGraph from a short description.
By MermaidViewer editorsPublished Updated
Example prompts for a git graph
- “GitFlow with release and hotfix branches”
- “Feature branch with rebase onto main”
- “Monorepo release train”
What a Mermaid git graph looks like
Example git graph
gitGraph
commit id: "init"
branch develop
checkout develop
commit id: "feature A"
branch feature/login
checkout feature/login
commit id: "login form"
commit id: "validation"
checkout develop
merge feature/login
checkout main
merge develop tag: "v1.0.0"
branch hotfix
checkout hotfix
commit id: "fix crash"
checkout main
merge hotfix tag: "v1.0.1"Want to write it by hand? See the full Mermaid git graph syntax and examples, or browse templates.
Merge a branch you never created and the picture will not render, which is the whole difficulty of an ai git graph generator. Trunk-based feature work, a release branch, a hotfix cut from a tag: the diagram is a script of Git commands, and the model has to obey checkout order. The widget above writes gitGraph. This page is about prompts that name branches before they merge them, and about the one-line fixes that should not cost a generation.
Histories it can sketch
A main branch with a short-lived feature branch is a standard scene, and the model usually gets it. commit, branch, checkout, and merge appear in a plausible order when you describe the order out loud. Tags land on the commit you called a release. Two feature branches in sequence, each merged before the next starts, also work. Highlighted commits show up if you ask for a commit to stand out, though you can live without that styling.
Commit ids you supply in quotes are kept more often than ids the model invents. Invented ids collide or contain spaces. A prompt that says "commit messages in double quotes, no spaces in branch names" avoids the boring parse errors. The git graph syntax is small: commit, branch, checkout, merge, cherry-pick, tag. Read a generated graph as a script you could almost run. If a line merges a name that has not been branched, the script is fiction.
Graphs that could not have happened
The classic botch is merge feature while the current branch is already feature, or before branch feature exists. Another is checkout develop when the only branch is main. The parser stops. A softer botch is a merge that is legal and still the wrong strategy: you asked for trunk-based development and received GitFlow with a develop branch that lives forever.
Cherry-picks name commits that were never created. Tags sit on the wrong branch because the model tagged main before checking out main. Branch names with slashes sometimes get quoted wrong, and feature/login is actually fine unquoted, while feature login is not a name. Commit ids with spaces and no quotes break the line. A flowchart of boxes labeled "merge" is the failure mode when the model forgets the keyword gitGraph entirely.
Reverse arrows and a commit type of REVERSE get sprinkled on ordinary work because they look clever. Leave them out unless you are teaching a revert.
Commands the prompt should list, in order
Write the history as a script, not as a philosophy of branching.
- The default branch name, usually main.
- Each other branch, and the moment it is created.
- The commits on that branch, with short messages.
- The checkout back to the branch that will receive the merge.
- The merge, after that checkout.
- Tags, and the branch that should wear them.
- An explicit "do not add develop" or "do not add a release branch" when you are drawing trunk-based flow.
The GitFlow template already has main, develop, feature, release, and hotfix, with version tags. Generate a new graph when you are teaching trunk-based work or a single hotfix. Open the template when the team really uses GitFlow and you only want to rename branches. The prompt guide is the broader method. On git graphs, order is the method.
Three prompts
- Git graph, trunk-based. Start on main with commit "init". Branch feature-pay. Commit "add charge". Commit "handle timeout". Checkout main. Merge feature-pay. Tag that merge "v1.4.0". Do not create develop. Do not cherry-pick. Quote every commit id.
- Git graph of a release branch. main has commit "init". Branch release-2, checkout release-2, commit "bump version". Checkout main, merge release-2, tag "v2.0.0". Branch hotfix-2, checkout hotfix-2, commit "null check". Checkout main, merge hotfix-2, tag "v2.0.1". Do not draw feature branches. Quote ids and tags.
- Git graph with two features in series, not parallel. main commit "init". Branch feature-a, commit "list view", checkout main, merge feature-a. Then branch feature-b, commit "empty state", checkout main, merge feature-b. No tags. No develop. Say in a commit id if a review fix landed on feature-a before its merge: commit "copy tweak" on feature-a before checking out main.
A trunk that stays a trunk
The pay feature is born, gets two commits, and merges to main. There is no develop branch hiding beside it. The tag sits on the merge, which is where a release engineer will look.
gitGraph
commit id: "init"
branch feature-pay
checkout feature-pay
commit id: "add charge"
commit id: "handle timeout"
checkout main
merge feature-pay tag: "v1.4.0"Open the editor if a second feature should start after the tag. Add it after the merge, not before the checkout back to main. Starting it early draws parallel history you did not mean.
When the script is illegal
Use an AI edit when the branch order is scrambled or a develop branch appeared from nowhere. "Trunk-based only. Create feature-pay before merging it. Checkout main before the merge. Put tag v1.4.0 on that merge. Delete develop and any cherry-pick." A generation is justified when you would otherwise replay the whole history in your head.
Edit a line yourself when one message is wrong or one checkout is missing. Change "add charge" to "add refund". Insert checkout main above a merge. Delete a cherry-pick of a ghost commit. Quote an id that has a space, or remove the space. Hand editing stays free. Git graph source is a command list. One illegal command is a one-line repair.
If the error says a branch does not exist, read upward. The branch line is missing or spelled differently from the merge line. Align the names in the editor and render again. Do not ask for a fresh history to fix a typo in feature-pay.
Free generations, and what they are not
You have five free AI uses in total. They are not a daily allowance. The account, the IP address, and a device cookie each have a counter, and the largest one is the one that applies. A git graph with one feature often renders on the first try. A graph that must exclude develop often needs a second try, because the model assumes GitFlow. Spend that second try. Then tag and rename by hand.
Look at pricing when the five are gone. The $6.99 Starter plan is the one that adds 500 AI conversations a month. Pro is $11.99 a month and includes unlimited AI under a fair-use cap, for day-to-day authoring rather than a loop that requests graphs. Hand editing stays free either way. You can keep a branching picture next to CONTRIBUTING.md and change a commit message without another prompt.
A sequence diagram is a better picture of a protocol. A git graph is a picture of refs. If you are on the wrong page, the AI diagram generator index will point you. Stay here when the question is which branch merged, and in what order.
Frequently asked questions
How do I generate a git graph with AI?
Describe the git graph you need in the box above and click Generate. The AI writes valid Mermaid git graph code that renders instantly, and you can open it in the editor to refine it.
Is the AI git graph generator free?
You can try it free: 5 AI generations in total, not per day, with no sign-up. Starter includes 500 AI conversations a month and Pro is unlimited. Manual editing stays available, and every plan can still download a PNG. JPG, SVG and PDF are on Pro.
Can I edit the generated git graph?
Absolutely. The output is plain Mermaid code — edit it by hand in the live editor, or ask the AI for changes in natural language.