To improve version control for Jupyter notebooks, consider using nbstripout
. This tool automatically removes output cells from notebooks before committing them to Git.
- Cleaner Version History: Eliminates unnecessary output data, making diffs more readable.
- Reduced Repository Size: Keeps the repository lightweight by excluding bulky output files.
- Consistent Results: Ensures that notebooks run consistently across different environments.
You can install nbstripout
using either pip
or conda
:
pip install nbstripout
or
conda install nbstripout
Navigate to your local repository directory and execute:
nbstripout --install
This command sets up a Git filter that automatically strips output from notebooks upon committing.
To confirm that nbstripout
is active, run:
nbstripout --status
For more information and advanced configuration options, refer to the official nbstripout
repository: https://github.com/kynan/nbstripout