Search code examples
pythongitgitignore

git continues to control changes on __pycache__ even when it is in gitignore


This is my .gitignore:

*__pycache__*
*.pyc
db.sqlite3
*.DS_Store
media/
res/

I can see on my Atom that __pycache__ directories are VcsIgnored (which implies that are recognized as not version controlled by git)

enter image description here

But, any way, when I make changes to a file, I get several __pycache__ files as modified and unstaged on my Atom git window:

enter image description here

I don't know wether the problem is in git or in Atom.


Solution

  • Try git rm --cached */__pycache__/*

    .gitignore file only inform git which new files should not be tracked. Do not remove from repository files already tracked.