Skip to content

Notebooks in git

jOtter writes standard nbformat 4 JSON with the same layout as JupyterLab, so switching tools doesn’t cause noisy diffs. Its autosaves live in ~/.local/state/jotter/, never in your repository.

Outputs, especially images, make diffs large. Press C to clear all outputs, then w to save. u brings them back if you change your mind.

To strip outputs automatically on every commit, use nbstripout:

Terminal window
pip install nbstripout
nbstripout --install # in the repository; adds a git filter

Your working copy keeps its outputs; only the committed version is stripped.

nbdime shows notebook diffs cell by cell instead of as raw JSON:

Terminal window
pip install nbdime
nbdime config-git --enable
git diff notebook.ipynb

When git changes a notebook that’s open in jOtter, jOtter reloads it, or asks first if you have unsaved changes. See Data safety.