Skip to content

About

Interactive Git & GitHub teaching aid — the student's visual companion. Open index.html in a browser.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Git From Zero

A self-paced walkthrough that takes someone from never having opened a terminal to a real repository on GitHub, with branches, a pull request, and a merge conflict they caused on purpose and fixed.

That link is the thing. This repo just holds it.

Who it's for

Anyone with zero Git experience, working alone. Most Git tutorials assume you already know what a terminal is, or that a second person is available to practise with. This one assumes neither: it starts at "here is how to open a terminal" and every exercise works solo, including the merge conflict.

What's in it

  • A live sandbox with three files. Type git init, add, commit, push, diff, restore into a fake terminal and watch the files move between the four places a change can live. Real Git output. Three files rather than one, because the staging area's whole justification is committing some changes and not others, which one file can describe but never demonstrate.
  • .gitignore that does something. Create secrets.env, watch Git offer to commit it, add a .gitignore, watch it vanish. Then find out that ignoring does nothing for a file you already committed, and that git rm --cached is the fix.
  • Branches in the sandbox: switch -c, merge, branch -d. Commits form a real DAG, so ancestry decides fast-forward vs merge commit, -d refuses an unmerged branch, and switching with uncommitted changes is refused exactly as Git refuses it.
  • A live commit graph beside it, showing main, origin/main and every branch as pointers into that DAG, so "ahead by 2", a rejected push, and a genuine fork stop being abstract.
  • Rebase, and the whole undo family: rebase, stash, reset --soft/--mixed/--hard, reflog, revert, commit --amend. A rebase leaves the abandoned originals on the graph as ghosts, and reflog really does recover what reset --hard threw away.
  • An eleven-task practical exam. Graded on the repository's actual state, not on what was typed, so any correct route works and there is no way to pass by copying a string. Close the tab halfway and it picks up where you left off: the same repository, down to the same commit IDs.
  • A merge-vs-rebase visualiser where the commit IDs visibly change on rebase: the detail that makes "rewriting history" finally click.
  • A clickable conflict block showing that <<<<<<< HEAD means opposite things in a merge and in a rebase, which is how people end up deleting their own work.
  • Nineteen badges that mean absolutely nothing. Most are for getting it wrong and coming back: reading the error, backing out of a merge, digging a commit out of the reflog. Getting stuck is most of learning Git, so it should count for something.
  • Per-OS commands (Windows / macOS / Linux), a table of the errors beginners actually hit, 56 filterable commands, and a quiz that remembers your answers.

Running it yourself

One file, no build step, no dependencies, no package manager:

git clone https://github.com/banditofsmoke/01-git-and-github.git
cd 01-git-and-github

Then just open index.html in a browser. That's it: it works offline, including the sandbox. To serve it over HTTP instead:

python -m http.server 8000

Tests

The sandbox is a pure state machine with no DOM access, so it can be tested directly:

node test.js

111 assertions, no dependencies, no build step, no test framework. test.js reads index.html and extracts the engine from between the ==GIT-ENGINE-START== / ==GIT-ENGINE-END== sentinels, and the progress code from between ==PROGRESS-CODE-START== / ==PROGRESS-CODE-END==, which keeps the page a single self-contained file you can still open from disk.

They cover the four-box transitions, the git diff-shows-nothing-after-add case, push rejection when the remote is ahead, fast-forward vs merge pulls, and (the reason they exist) that the guided Do the next thing button can walk a user all the way to GitHub without typing. That last one is a regression test: it previously could not, because nothing offered git remote add or git push -u.

The progress code has its own: it has to survive the round trip, still read a code made before it carried the quiz and the practical, and refuse anything that isn't one.

Built with

Nothing. Hand-written HTML, CSS and vanilla JavaScript in a single file. The only external request is to Google Fonts; block it and the page falls back to system fonts and still works.

Privacy

No accounts, no analytics, no tracking, no database, no server-side anything. Your progress, quiz answers, practical, badges, chosen OS and theme are kept in your own browser's localStorage and never leave your machine. If your browser blocks site storage, the page says so and everything still works, you just don't get progress saved.

To carry it all to another browser, copy your progress code and paste it there. The code is the progress, written out, so there is nowhere else it is kept.

Teaching it to someone else

Two guides, for two different situations. Both are current; neither replaces the other.

Guide Use it when
LESSON-PLAN.md The learner works through the site at their own pace and you coach. One-to-one, a group, or over a call. Mirrors the site's ten steps and adds timings, what to say, where people stall, and a checkpoint question for each, plus which sandbox drill to run before each command, and how to read the practical as assessment.
LESSON-PLAN-PAIRED.md You want the two-person lesson: you and one learner sharing a repo, both pushing, conflicting with each other for real. Needs two machines and two GitHub accounts. Uses the site's sandbox for rehearsal and its practical as the closer.

The short version of both: the site does the explaining, so the teacher's job is unsticking, checking understanding, and not taking the keyboard.

Notes

Command output was captured from a real repository rather than written from memory, including the conflict markers, whose sides genuinely do swap between a merge and a rebase. Install instructions were checked against git-scm.com/install rather than assumed; the old git-scm.com/downloads URL now redirects, and the macOS binary installer was discontinued in 2021.

Icons (favicon.svg, favicon.ico, apple-touch-icon.png, icon-512.png) all draw one mark: a commit node branching to another, in the page's own violet and steel.

About

Interactive Git & GitHub teaching aid — the student's visual companion. Open index.html in a browser.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages