How to git ignore ipython notebook checkpoints anywhere in repository
I would recommend to use **/*.ipynb_checkpoints/
in your .gitignore
file.
If you add to .gitignore:
.ipynb_checkpoints
(no slashes anywhere), any file or directory in the repo with that name will be ignored. Paths are only checked if you include /
.
From this answer you can also have a global gitignore for your computer:
git config --global core.excludesfile '~/.gitignore'
echo '.ipynb_checkpoints' >> ~/.gitignore
Add to your .gitignore
:
.ipynb_checkpoints
*/.ipynb_checkpoints/*
And you should be good to go.
If you haven't pushed your code yet, add
.ipynb_checkpoints
to your .gitignore
If you have already pushed your code before, add
.ipynb_checkpoints
to your .gitignore. This will ensure that .ipynb_checkpoints will be ignored in the future but doesn't remove your old .ipynb_checkpoints
You have to manually remove the cache in every folder in the respective branch. Go to the folder that has the .ipynb_checkpoints at first and do
git rm -r --cached .ipynb_checkpoints