Look into nbstripout to auto clear notebook output
All notebooks (including the solutions) should have outputs cleared before being committed to the repo. Any "output" that should not be cleared should be "hardcoded" as markdown text in the notebooks. This is because generated plots in particular eats up unnecessary storage space and is impossible to view as diff.
If you have nbstripout installed, this is the scary git command to apply retroactively:
git filter-branch -f --index-filter '
git checkout -- :*.ipynb
find . -name "*.ipynb" -exec nbstripout "{}" +
git add . --ignore-removal
'
Ah, I take it back - that will also remove the cell metadata (i.e. "raises-exception" tags)! Hmm...
@adrn , I don't mean clean the git history. I meant this for more like a cleaner repo going forward.
Does "clear all outputs" also clear the "raises-exception" tags? :scream:
I don't mean clean the git history. I meant this for more like a cleaner repo going forward.
But then we're stuck with the already large, current size of the repo...
Does "clear all outputs" also clear the "raises-exception" tags? 😱
No, it shouldn't!
I think it is easier to squash and force push to master than to do some filter-branch magic. :fire:
Also, if you must... https://git-scm.com/docs/git-filter-branch#_warning, which suggests https://github.com/newren/git-filter-repo/