1

Build This Git Graph

Reproduce the target graph

Every command you run in the terminal is appended to reproduce.sh (the tab on the left). 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 myproject && cd myproject.
  • 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 in the top bar. The VM rewinds to post-boot and replays the (shorter) script — a one-command undo without any bespoke button.
  • Full restart: clear reproduce.sh entirely and click Reset.

Target

Reproduce the following branch topology inside myproject:

@startuml
branch main:
  A "Initial commit"
  B "Add README"
  C "Release 1.0"
  D "Add logging support"
  E merge feature/parser "Merge feature/parser"

branch feature/parser from C:
  F "Add tokenizer"
  G "Add error recovery"
  H "Wire parser into build"

branch experiment from C:
  I "Add experimental optimization"
  J "Try aggressive inlining"

head main
@enduml

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 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.
Starter files
reproduce.sh
#!/bin/bash
set -e