nbstripout is a filter that removes numbering and output from jupyter notebooks.
The script nbstripout
was found
here with inspiration
from here (see the discussion there).
Download the file.
Add the following in the file .git/config
:
[filter "stripoutput"]
clean = "scripts/nbstripout"
smudge = cat
required
and also write a .gitattributes
file:
*.ipynb filter=stripoutput
Whenever a Jupyter notebook (detected by the extension .ipynb
) is
submitted to git diff
or git commit
, it is converted by the filter. The filter removes
all numbering (that might change upon execution) and the output (that might contain binary
data for figures, etc).