Z
Z
zlodiak2019-04-16 15:23:16
Python
zlodiak, 2019-04-16 15:23:16

How to exclude all pycache directories from the index?

I have a python project. As it develops, a __pycache__ directory appears in each directory. When pushing to git, I exclude this directory from the index like this:
.gitignore

venv
/__pycache__
/app/__pycache__
*/__pycache__

The problem is that over time there are a lot of directories in the project, so I have to add something to .gitignore all the time to exclude __pycache__
Please tell me if it is possible to write some pattern in .gitignore once that will exclude from the index __pycache__ directories and .pyc files of any nesting?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
toporov, 2020-09-25
@toporov

You can, with this template:
**/__pycache__

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question