Git Playground
Write, run, and share code snippets - no setup required.
git log --oneline --graph --allCommits after this step
- ea85bd9 Merge branch 'feature' (HEAD -> main) <- f5363c6, 47b6cfb
- 47b6cfb Work on feature (feature) <- b2134da
- f5363c6 Hotfix on main <- b2134da
- b2134da Add app.txt
- Working tree clean
Every Run replays the whole script and snapshots the repository after each line. Click a step to see the graph at that moment.
Try common Git commands
Git runs in this terminal too. Load a ready-made workflow into the prompt, hit Run to watch every command execute, then open the full guide for any command you want to understand.
git initecho "hello" > app.txtgit add app.txtgit commit -m "Add app.txt"git checkout -b featureecho "new feature" >> app.txtgit commit -am "Work on feature"git checkout -git merge featuregit log --oneline --graph
git initecho "v1" > notes.txtgit add notes.txtgit commit -m "Add notes.txt"echo "v2" >> notes.txtgit commit -am "Oops, wrong message"git reset --soft HEAD~1git statusgit commit -m "Update notes.txt"git log --oneline
An online Git playground with a live commit graph
A free Git playground that runs real git in a sandboxed Linux terminal, not a JavaScript imitation of it. Type commands on the left - git init, git add, git commit, git branch, git merge, git rebase, git reset - press Run, and the repository pane on the right redraws the commit graph, the branches, HEAD, and the working tree after every line of your script. It is the fastest way to practice Git online and actually see what each command did.
Every Run replays your whole script from an empty folder and takes a snapshot of the repository after each statement, so you can click any step and see the graph at that exact moment. A commit that a git reset left behind stays on the picture, faded, so an undo shows what it undid. Nothing to install, no account, no repository of yours is ever touched.
What makes this Git playground different
- Real Git, real output: the sandbox runs the genuine
gitbinary on Linux, so error messages,git log --graph,git statusand the flags behave as they do on your machine - unlike a Git simulator that only knows the commands its authors modelled. The one deliberate difference: the author identity and the commit dates are fixed, so hashes stay the same between runs. - A commit graph that updates after every line: branches as lanes, merges as curves,
HEADand every ref as a label on its commit, plus the staged, modified, untracked and conflicted files read fromgit status. Click a step to scrub back through the history of your session. - Practice the commands people search for most: undo a commit, squash commits, rebase onto main, cherry-pick, stash, resolve a merge conflict, force-push safely. Load a ready-made workflow below, or open any page of the Git command reference and press "Try it live".
- Remotes without a network: create a local bare repository, add it as
origin, and practicegit push,git fetch,git pullandgit cloneagainst it. The graph showsorigin/mainmoving next tomain. - Deterministic runs: dates and identity are pinned, so the same script always produces the same commit hashes. Share a script with a classmate and both of you see the same graph.
What to try in the Git playground
- Branch and merge:
git checkout -b feature, commit on it, switch back tomain, commit there too, thengit merge featureand watch the merge commit join the two lanes. - Undo safely: make a commit you regret, run
git reset --soft HEAD~1, and see the commit fade out of the graph while your changes reappear as staged files. Then trygit revertand compare. - Rebase versus merge: build the same two-branch history twice, finish one with
git mergeand the other withgit rebase main, and compare the shape of the two graphs side by side. - A merge conflict on purpose: change the same line on two branches, merge, and watch the file land in the Conflicts row. Fix it,
git add,git commit, and see the conflict clear.
Git playground FAQ
Is this Git playground free?
Is this real Git or a simulation?
git binary inside a sandboxed Linux container, so commands, flags, output and error messages match what you see locally. Two things are added on purpose: a default author identity (which a git config user.name of your own overrides, as it would locally) and pinned commit dates, so that commit hashes are the same on every Run. Nothing can prompt you mid-run, so an interactive command such as git rebase -i needs a scripted editor - the examples show how.How does the commit graph work?
HEAD, stash list and git status. The page draws the graph from those snapshots: one lane per branch, merges as curves, and every ref as a label. Click a step number to see the repository as it was right after that line. In a very long session the earlier prompts are captured only at their end, and the step strip shows just the states that were actually recorded.Can I practice branching, merging and rebasing here?
Can I use git push, pull, fetch and clone?
git clone https://… cannot reach the internet. Create a bare repository in a subfolder (git init --bare remote.git), add it as origin, and push, fetch, pull and clone from it - the remote-tracking branches appear in the graph like they would for GitHub.Does my work persist between runs?
How is this different from the online Linux terminal?
Is there a course that teaches Git from scratch?
git init to branches, merges, rebases and remotes with checked exercises, and every command page in the Git command reference has a "Try it live" button that opens this playground with a runnable example.