Skip to content

Instantly share code, notes, and snippets.

@rob-b
Forked from codysoyland/post-checkout
Last active October 8, 2015 03:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rob-b/3273216 to your computer and use it in GitHub Desktop.
Save rob-b/3273216 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 > /dev/null 2>&1 &
find . -type d -empty -delete > /dev/null 2>&1 &
@rob-b
Copy link
Author

rob-b commented Feb 24, 2014

curl -o .git/hooks/post-checkout https://gist.githubusercontent.com/rob-b/3273216/raw/fbceabfabb205b7d6bfa52bb01fe1e685d3d321d/post-checkout
chmod u+x !:2

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