Skip to content

Instantly share code, notes, and snippets.

@m4nh
Last active June 3, 2024 02:17
Show Gist options
  • Save m4nh/a58d0cbe6de5eedad43b5a15f6441153 to your computer and use it in GitHub Desktop.
Save m4nh/a58d0cbe6de5eedad43b5a15f6441153 to your computer and use it in GitHub Desktop.
#nbstripout #pre-commit #hook

Install nbstripout

pip install --upgrade nbstripout

in target repository:

nbstripout --install
nbstripout --install --attributes .gitattributes

Configure Pre-Commit hook

Using nbstripout as a pre-commit hook pre-commit is a framework for managing git pre-commit hooks.

Once you have pre-commit installed, add the follwong to the .pre-commit-config.yaml in your repository:

repos:
- repo: https://github.com/kynan/nbstripout
  rev: master
  hooks:
    - id: nbstripout
      files: ".ipynb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment