I have a project and there are lots files with the name .ipynb_checkpoints
or __pycache__
. How do I add those to the gitignore. I have copied and pasted the few below but want to know the proper way.
*.ipynb_checkpoints
*.ipynb_checkpoints/
*.ipynb_checkpoints/.
*.ipynb_checkpoints/*
*.__pycache__
*.__pycache__/*
*.__pycache__/
*.__pycache__/.
CodePudding user response:
The __pycache__
folders (directories) that Python uses to store byte-compiled Python code into are most easily ignored with a single line reading:
__pycache__/
The trailing slash is optional. Note that there is no dot .
character here.
The .ipynb_checkpoints
folder that Jypter uses can be ignored the same way: just list its name with an optional trailing slash. See also Should ipynb checkpoints be stored in Git? and How to git ignore ipython notebook checkpoints anywhere in repository.