Remove all .pyc files from a git repository

When working on Python project you may sometimes forget to .gitignore your
*.pyc files and end up having them tracked by the repo.

To fix this you need use git rm:

find . -name "*.pyc" -exec git rm -f {} \;

Then, add a line:


to the .gitignore file in the repository root to have them permanently

Credit goes to Yuji.

Leave a Reply

Your email address will not be published. Required fields are marked *