Last active
January 30, 2018 05:52
-
-
Save joncotton/4660441 to your computer and use it in GitHub Desktop.
Git hook to remove *.pyc files and empty directories. Put in `.git/hooks/post-checkout` and chmod +x to make it run.
This file contains hidden or 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
| #! /bin/sh | |
| echo "Purging pyc files and empty directories..." | |
| # Start from the repository root. | |
| cd ./$(git rev-parse --show-cdup) | |
| # Delete .pyc files, empty directories and MacOS cruft | |
| find . -name '*.pyc' -delete 2>&1 > /dev/null & | |
| find . -type d -empty -delete 2>&1 > /dev/null & | |
| find . -type f -name '.DS_Store' -delete 2>&1 > /dev/null & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment