Strip Jupyter notebook outputs from Git

Jupyter notebook outputs can be large (plots, images, etc.), making Git repo history excessively large and making Git operations slower as the Git history grows. Jupyter notebook outputs can reveal personal information with regard to usernames, Python executable, directory layout, and data outputs.

Strip all Jupyter outputs from Git tracking with a client-side Git pre-commit hook by configuring Git pre-commit hooks. We use Git pre-commit hook because Git filters can interfere with other programs such as CMake ExternalProject.

Configure Git user-wide where to use an IPython script to strip Jupyter notebook outputs by:

git config --global hook.lintipython.event pre-commit
git config --global hook.lintipython.command '$HOME/linters/strip-ipython.py'

Use an IPython linter script like ~/linters/strip-ipython.py. On Unix-like systems, the script must have execute permissiong like:

chmod +x ~/linters/strip-ipython.py