Git remove all .pyc files

I ran into this recently with a project which already had several git commits but was still tracking .pyc files. This was starting to cause problems so I had to find a way to remove them from the repo:

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

Then *.pyc can be added to the .gitignore file.

Thanks to Yuji Tomita for this information which can be found here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s