Skip to content

Instantly share code, notes, and snippets.

@ronnix
Created March 10, 2014 16:50
Show Gist options
  • Save ronnix/9468892 to your computer and use it in GitHub Desktop.
Save ronnix/9468892 to your computer and use it in GitHub Desktop.
$ cat .git/hooks/post-checkout
#!/bin/bash
# Remove stray .pyc files
find . -name '*.pyc' -delete
# Update requirements if needed
for filename in requirements.txt dev-requirements.txt test-requirements.txt ; do
CHANGED=`git diff HEAD@{1} --stat -- $GIT_DIR/../$filename | wc -l`
if [ $CHANGED -gt 0 ];
then
echo "$filename has changed!"
pip install -r $filename
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment