To remove all your .pyc files from your git repo…
First, git rm
them
find . -name "*.pyc" -exec git rm -f {} \;
Then, add a .gitignore file in the root of your repo and enter a line:
*.pyc
to prevent them from being added automagically in the future without an -f
very useful for git newbies (like me). one addition i would make is to change “*pyc” to “*.pyc”, otherwise you may accidentally wipe out files that end in pyc as well (rather than files with the extension pyc) – unlikely but possible!
thanks…really helped
reposted and linked back to your blog. Hope that’s ok. Really helpful!!!
http://davidreynon.com/git-mass-delete-by-find/
Hey David,
Thanks for the link back! Awesome 🙂
I’ve been using the following more often recently as I can never remember the -exec syntax.
find -name “*.pyc” | xargs git rm