Last active
December 11, 2015 20:19
-
-
Save sigilioso/4654540 to your computer and use it in GitHub Desktop.
post-checkout hook to remove old pyc files and avoid errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# post-checkout hook (on <path-to-project>/.git/hooks/post-checkout file) | |
# to avoid errors for old pyc files when checkout. | |
# Remember execution privileges (chmod +x <path-to-project>/.git/hooks/post-checkout). | |
#!/bin/bash | |
# Start from the repository root | |
cd ./$(git rev-parse --show-cdup) | |
# Delete pyc and empty directories | |
echo "[post-checkout] Deleting .pyc and empty directories" | |
find . -name "*.pyc" -delete | |
find . -type d -empty -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment