Search code examples
gitgitignore

.gitignore Django project's __pycache__ folder


I have been trying a lot of different commands but nothing seems to be working to Git ignore all the __pycache__ folders and their files in my project. I have written the following code in my .gitignore file and need help to ignore all __pycache__ in any subfolder of my Django project:

**/__pycache__/**

frontend_react_app/node_modules/
frontend_react_app/build

Thanks


Solution

  • You can simply use:

    __pycache__/
    

    Note that if the files are already tracked in a commit, you need to also follow the directions in: How do I make Git forget about a file that was tracked, but is now in .gitignore?