Getting started
Install
git-sb3 needs Node 18 or newer and git on your PATH. Once it's
installed globally, git discovers it automatically — git sb3 <command> and
git-sb3 <command> are equivalent, because git runs any git-<name> executable
on your PATH as the subcommand git <name>.
Wire it into a repo
In a repository that contains .sb3 files:
install does two things:
- Registers a
textconvdiff driver namedsb3in your git config. - Adds
*.sb3 diff=sb3to the repo's.gitattributesso git uses that driver for every.sb3.
Commit the .gitattributes change so collaborators get readable diffs too (they
each run git sb3 install once to register the driver locally).
git sb3 install --global writes the driver to your global git config. It then
prints the one *.sb3 diff=sb3 line to add to your global attributes file
(git config --global core.attributesFile).
Your first readable diff
Edit a project — through the Scratch editor, scratch4js, or
by hand via unpack — then ask git what changed:
Instead of Binary files differ, you'll see scripts as scratchblocks and the
exact variables, costumes and sounds that changed:
git log -p, git show, and git diff <commit> all use the same driver, so the
whole history is reviewable.
Then: a visual report
For a graphical view of your uncommitted changes, render an HTML report:
Open it in a browser to see the changed scripts drawn as real Scratch blocks. See Visual diffs for the forms and what the report contains.
How the diff driver works
A git textconv
driver tells git: "before diffing this binary file, run it through a program and
diff the program's text output instead." install configures:
So git calls git-sb3 text <file> (the text command)
on each side of a change and diffs the readable output. cachetextconv caches
that output by blob, so repeated diffs of unchanged history are instant.
Next steps
- Commands — every command and option.
- Visual diffs — the scratchblocks HTML report.