The python package "nbstripout" works well for me....
# beginners-need-help
v
The python package "nbstripout" works well for me. Install it, add three lines to your .gitattributes file, and it strips all outputs and metadata from a notebook upon "git add *", which makes for a clean git workflow. https://github.com/kynan/nbstripout