This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.
To use the script, follow the instructions given in the script's docstring.
For further details, read this blogpost.
The procedure outlined here is inspired by this answer on Stack Overflow.
With jq you can implement this entirely inside the git configuration, which then makes it easy to turn it on for a specific repo.
Add the following to
.git/config
:Create the file
.git/info/attributes
with the content from above:This does not conditionally prevent the formatting of the notebooks using the metadata. I'm sure it would be possible to check for this by wrapping the overall statement in an if.