Skip to content

Commit

Permalink
added filter to notebook commits
Browse files Browse the repository at this point in the history
Now when one stages a notebook it will be filtered
through an nbconvert that removes the output.

Simply add this into your .gitconfig, or .git/config

[filter "strip-notebook-output"]
    clean = "jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR"

Then you will surely never commit a notebook with output
cells.

Signed-off-by: Nick Papior <nickpapior@gmail.com>
  • Loading branch information
zerothi committed Nov 2, 2023
1 parent 83feb81 commit 94510c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CITATION.cff export-subst
pyproject.toml export-subst
.git_archival.txt export-subst
*.ipynb filter=strip-notebook-output

6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ We love your input! We want to make contributing to this project as easy and tra
## We Develop with GitHub
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.

Our repository uses a filter on Jupyter notebooks. So if you are planning on changing notebook content,
you should add this change to your `.git/config`, or in your global `.gitconfig` file:

[filter "strip-notebook-output"]
clean = "jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR"

## First-time contributors
Add a comment on the issue and wait for the issue to be assigned before you start working on it. This helps to avoid multiple people working on similar issues.

Expand Down

0 comments on commit 94510c8

Please sign in to comment.