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.
I get an error.
Here's the end of
git config -l
to show I have the right line in there:Here's the content of .gitattributes:
Here's my try to use it:
Here's the content of my $HOME/bin which is on the PATH: