When working with Jupyter Notebooks, the output of each cell does not need to be committed as:
- It can contain sensitive information
- It makes the diff harder to read
- It can be easily regenerated by re-running the notebook
This can be achieved by adding a Git filter:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'
and enabling it for
.ipynb files using a local
git status will be readable as only the changes to cell contents (and any
new cells) will be tracked.
Advice lifted from this Gist.