Skip to content

Instantly share code, notes, and snippets.

@ThiefMaster
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThiefMaster/20d30a7c95281ada6663 to your computer and use it in GitHub Desktop.
Save ThiefMaster/20d30a7c95281ada6663 to your computer and use it in GitHub Desktop.
post-checkout githook which cleans up all pyc/pyc/__pycache__ files/folders. to enable, save as post-checkout in .git/hooks and chmod +x
#!/bin/bash
prev_head=$1
new_head=$2
checkout_type=$3
[[ $checkout_type == '1' ]] || exit 0
[[ $prev_head == $new_head ]] && exit 0
cd "./$(git rev-parse --show-cdup)"
find . \( -name '*.pyc' -or -name '*.pyo' -or -name '__pycache__' \) -exec rm -rf {} +
rm -r .coverage htmlcov 2> /dev/null
rm -r ~/dev/indico/data/tmp/mako_modules/ 2> /dev/null
echo Cleaned up python cache files
exit 0
@OmeGak
Copy link

OmeGak commented Sep 3, 2014

🌋

@pferreir
Copy link

I totally need my checkouts to become even slower. Thanks 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment