How to use this page
- slider / ▶Drag the slider, or press play, to watch the command happen. Before and After jump to either end.
- ← → · spaceStep through a multi-step command; space toggles Before / After.
- APlay or pause the loop (the page opens playing). Any manual input takes over.
- hoverA commit shows its message, author, date and parents, with its history highlighted.
- clickCopies the commit sha.
- ctrl + wheelZoom around the cursor (pinch on a trackpad). Double-click resets the view.
- EscStop playback, reset the view, close this menu.
- shareThe Share button copies a link to this graph, copies it as an image, downloads PNG/SVG/page, or posts it. #before, #after or #step=N in the link pins the state.
Live demo: git rebase branch1 on a sample repository, exactly as git-sim opens it for your own repos.
Press play, drag the slider, hover a commit.
What is git-sim?
git-sim shows you what a Git command will do to your own repository before you run it. Type the command with git-sim in front of git, and instead of changing anything it opens an interactive before / after graph of the result.
It reads your real repository, so the graph is your branches, your commits and your working tree, not a diagram of somebody else's. Nothing is committed, moved or deleted.
See it before you run it
The commands that rewrite history or discard work are the ones worth a look first. Each simulation plays from the repository as it is to the repository as it would be, one change at a time.
git-sim rebase main
Watch each commit lift off the old base, slide onto the new one and reconnect, then the branch label move.
git-sim reset --hard HEAD~2
See which commits fall out of reach, which files change, and where HEAD lands.
git-sim merge feature
Fast-forward or merge commit? See the answer and the parents before you commit to it.
git-sim cherry-pick a1b2c3..d4e5f6
Each pick appears in order with its link back to the commit it copies.
git-sim stash, add, restore
Files move between the working directory, the index and the stash in a table beneath the graph.
git-sim log --all
A clean picture of every branch, with each lane in its own colour.
Hover a commit for its message, author, date and parents, with its history highlighted. Click to copy its sha. Ctrl + wheel zooms.
Install in one line
pip install git-sim
Then, inside any Git repository:
git-sim rebase main
git-sim reset --hard HEAD~2
git-sim merge feature
Each command writes a self-contained interactive page under git-sim_media/ and opens it here, in this viewer. Prefer to open the saved file itself? Add --open-in local, or set git_sim_open_in=local once. Want a plain picture? --img-format jpg or png. Want video? --animate renders an MP4 through Manim, installed with pip install "git-sim[extras]".
Requires Python 3.10 or newer and Git. Works on Windows, macOS and Linux.
Share a simulation
The Share button on any simulation copies a link that opens the graph right here, with a preview card when you post it on X, Bluesky, LinkedIn, Reddit or Hacker News. It also copies the graph as an image, or downloads it as PNG, SVG or a single HTML file to attach to a pull request.
The graph itself travels compressed inside the link's #fragment, which browsers never send to a server, so your repository's data stays with you. When git-sim opens this page for you, nothing about you, your repository or your code reaches our server at all. A link you choose to share carries the command and a short text graph (git log --oneline, up to 12 lines) in its query string, so the link gets a proper preview card.
Let your AI agent check first
AI coding agents run Git on your behalf. git-sim gives them a pre-flight check: an MCP server and a hook for Claude Code, Cursor, Codex, GitHub Copilot and Gemini CLI. Before an agent runs a destructive command, the hook computes the exact consequences from your real repository, never from the model's guess, and asks you to approve with the facts, a text graph and the simulation in front of you.
git-sim install
That detects the agents on your machine and wires the hook and the MCP server into each one's own configuration. Read how the pre-flight check works.
Supported commands
| Area | Commands |
|---|---|
| History | log, reflog, status |
| Working tree and index | add, restore, rm, mv, clean, stash |
| Commits | commit (including --amend), revert, cherry-pick (ranges too) |
| Branches and tags | branch, checkout, switch, tag, worktree |
| Rewriting history | rebase, rebase -i with a todo file, rebase --onto, reset in every mode |
| Merging | merge, fast-forward or not, with conflict prediction |
| Remotes | clone, fetch, pull, push, remote, submodule |
| Setup | init, config |
Flags follow Git's own. The README on GitHub lists every option per command.
Questions
How can I see what a Git command will do before running it?
Run the command through git-sim instead of git, for example git-sim rebase main. It reads your real repository, simulates the command without touching it, and opens an interactive before / after graph of the result.
Does git-sim change my repository?
No. git-sim only reads the repository. Nothing is committed, moved or deleted; the simulation is written as a page or image under git-sim_media/ in the repository folder.
Is my code uploaded when git-sim opens the viewer here?
No. The graph travels inside the link's #fragment, which browsers never send to a server, and the link git-sim opens carries nothing else about you or your repository. Pass --open-in local to open the saved page directly instead.
Which Git commands can git-sim simulate?
add, branch, checkout, cherry-pick, clean, clone, commit, config, fetch, init, log, merge, mv, pull, push, rebase (including -i and --onto), reflog, remote, reset, restore, revert, rm, stash, status, submodule, switch, tag and worktree, with their common flags.
Can an AI coding agent use git-sim?
Yes. git-sim ships an MCP server and a pre-flight hook for Claude Code, Cursor, Codex, Copilot and Gemini. Before an agent runs a destructive Git command, the hook computes the deterministic consequences from the real repository and shows you the facts and the simulation for approval.
git-sim is free and open source, made by Initial Commit. Also from us: Devlands, where you learn Git by walking through your repository as a 3D world.