Is there a difference between
# Python
**/__pycache__
**/*.py[cod]
and
# Python
__pycache__
*.py[cod]
I see most sites suggesting the second one, but if those build files shouldn't exist shouldn't they be banished from subfolders too? Doesn't the second one seem to care only about the root folder?
Both of your examples ignore __pycache__
and *.py[cod]
files in any directory. To only ignore files in root folder, there needs to be a slash in front of the path:
/__pycache__
/*.py[cod]
**
is typically used if there is a more complex directory structure, for example:
/dirA/**/__pycache__