Copy nbflatten.py to somewhere on $PATH. Then, in the root of a git repository, run these commands:
echo "*.ipynb diff=ipynb" >> .gitattributes
git config diff.ipynb.textconv nbflatten.py
When you change a notebook and run git diff
, you'll see the diff of flattened, simplified notebooks, rather than the full JSON. This does lose some information (metadata, non-text output), but it makes it easier to see simple changes in the notebook.
This doesn't help with merging conflicting changes in notebooks. For that, see nbdiff.org.
Make it executable? Oh, sorry, it is. Do you have a /usr/bin/python3? I believe you'll see "No such file or directory" if the kernel can't find the executable named in the shebang line. Somethimes this happens with DOS-style files when the carriage return is taken as part of the filename.