Git Playground
An open-ended Git sandbox. Every command you type is recorded into reproduce.sh so you can replay, tweak, and step back through your session.
Build This Git Graph
Reproduce the target graph
Every command you run in the terminal is appended to reproduce.sh (the
tab). The script is the single source of truth for your
session — re-running it from a clean VM reproduces exactly the state
you’re in right now.
- Start any project:
git init. - Live graph: switch to the Git Graph panel to compare your repository to the target below.
- Undo the last command: open
reproduce.sh, delete the last line, then click Reset Current Step. The VM rewinds to post-boot and replays the (shorter) script — a one-command undo without any bespoke button. - Full restart: clear
reproduce.shentirely and click Reset.
Target
Reproduce the following branch topology inside myproject:
Detailed description
Git commit graph with 9 commits across 3 branches (main with 4 commits: "Initial commit", "Add README", "Release 1.0", "Add logging support"; feature/parser with 3 commits, branched from C: "Add tokenizer", "Add error recovery", "Wire parser into build"; experiment with 2 commits, branched from C: "Add experimental optimization", "Try aggressive inlining"). HEAD on main.
Branches
- main (4 commits)
- feature/parser (3 commits, branched from C)
- experiment (2 commits, branched from C)
Commits on main
- A — Initial commit
- B — Add README
- C — Release 1.0
- D — Add logging support
Commits on feature/parser
- F — Add tokenizer
- G — Add error recovery
- H — Wire parser into build
Commits on experiment
- I — Add experimental optimization
- J — Try aggressive inlining
HEAD
- HEAD points to main
Rules
- Use only basic git commands: init, add, commit, branch, switch (or checkout), and merge. No rebase, revert, or tags (you’ve not learned these commands in this class yet anyways, so why bother?)
- Commit subjects must match exactly (case and punctuation).
- Every commit must actually change a file. No –allow-empty.
- File contents, authors, and timestamps do not matter.
Two things to watch out for and make sure you get right:
- The top merge must be a real merge commit, not a fast-forward. This means you have to commit Add logging support on main before you merge feature/parser. Otherwise git fast-forwards and no merge commit is created.
- The experiment branch is never merged. Create it, commit to it, and leave it alone. Don’t delete it.
#!/bin/bash
set -e