Menu
Coddy logo textTech

Git Playground

Write, run, and share code snippets - no setup required.

Git terminal
user$ git init
user$ echo "hello" > app.txt
user$ git add app.txt
user$ git commit -m "Add app.txt"
user$ git checkout -b feature
user$ echo "new feature" >> app.txt
user$ git commit -am "Work on feature"
user$ git checkout main
user$ echo "fix" > fix.txt
user$ git add fix.txt
user$ git commit -m "Hotfix on main"
user$ git merge feature
user$
RepositoryOn branch main
git log --oneline --graph --all

Commits 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.

Start a repo and make your first commitInitialize a repository, stage a file, commit it, and check the status.
  1. git init
  2. git config user.name "You"
  3. git config user.email "you@example.com"
  4. echo "# My Project" > README.md
  5. git add README.md
  6. git commit -m "Initial commit"
  7. git status
  8. git log --oneline
Create a branch and merge itBranch off, make a change, commit, then merge the branch back into main.
  1. git init
  2. echo "hello" > app.txt
  3. git add app.txt
  4. git commit -m "Add app.txt"
  5. git checkout -b feature
  6. echo "new feature" >> app.txt
  7. git commit -am "Work on feature"
  8. git checkout -
  9. git merge feature
  10. git log --oneline --graph
Undo the last commitMake a commit you regret, then undo it while keeping your changes.
  1. git init
  2. echo "v1" > notes.txt
  3. git add notes.txt
  4. git commit -m "Add notes.txt"
  5. echo "v2" >> notes.txt
  6. git commit -am "Oops, wrong message"
  7. git reset --soft HEAD~1
  8. git status
  9. git commit -m "Update notes.txt"
  10. 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 git binary on Linux, so error messages, git log --graph, git status and 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, HEAD and every ref as a label on its commit, plus the staged, modified, untracked and conflicted files read from git 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 practice git push, git fetch, git pull and git clone against it. The graph shows origin/main moving next to main.
  • 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 to main, commit there too, then git merge feature and 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 try git revert and compare.
  • Rebase versus merge: build the same two-branch history twice, finish one with git merge and the other with git 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?
Yes. The Git playground is free, needs no sign-up and no install. Open the page, type a command, press Run.
Is this real Git or a simulation?
Real Git. Each Run executes your script with the genuine 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?
After every statement in your script the sandbox records the repository's commits, refs, 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?
Yes - that is what the graph is for. Create branches, commit on them, merge, rebase, cherry-pick, reset and revert, and see each operation change the picture. It is a hands-on alternative to a branching game, with real Git underneath.
Can I use git push, pull, fetch and clone?
Against a local remote, yes. The sandbox has no network access, so 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?
No. Every Run starts from an empty folder and replays the whole script, which is what makes the timeline possible. Keep your commands in the prompt (Shift+Enter adds a line), and use Reset to return to the starter script.
How is this different from the online Linux terminal?
It is the same sandboxed terminal - Git runs there too - with a repository pane added. The Linux terminal page is for shell commands and scripts; this page composes your session so that the commit graph and working-tree state are captured after each line.
Is there a course that teaches Git from scratch?
Yes. Coddy's free Git course walks from 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.