Notebooks are awesome for experimentation, but hard to work with within repositories. Whenever it’s time to comit, I always felt I had to chose between comitting the cell outputs, making diffs huge and not fun to work with, or stripping the output and loosing it locally.
This gist shows how to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally:
Add a filter to git config by running the following command in bash inside the repo:
One comment at the bottom is important to add to the receipe, which is to “run git add --renormalize . to go through all of your existing notebook files and scrub the outputs. Otherwise, you could get heinous merge conflicts later.”