Skip to content

Instantly share code, notes, and snippets.

@codysoyland
Created January 18, 2011 20:19
Show Gist options
  • Save codysoyland/785061 to your computer and use it in GitHub Desktop.
Save codysoyland/785061 to your computer and use it in GitHub Desktop.
place in .git/hooks/post-checkout to delete empty directories and pyc files
#! /bin/sh
echo "Purging pyc files and empty directories..."
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
find . -name "*.pyc" -delete 2>&1 > /dev/null &
find . -type d -empty -delete 2>&1 > /dev/null &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment