Last active
July 22, 2018 22:37
-
-
Save linssen/5729266 to your computer and use it in GitHub Desktop.
A post checkout hook to automatically remove *.pyc files.
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 | |
green='\033[0;32m' | |
nc='\033[0m' | |
# Start from the repository root. | |
cd ./$(git rev-parse --show-cdup) | |
# Delete .pyc files and empty directories. | |
echo "${green}Deleting PYC files...${nc}" | |
find . -name "*.pyc" -delete | |
find . -type d -empty -delete | |
echo "${green}Resetting submodules...${nc}" | |
git submodule foreach git reset --hard HEAD | |
git submodule update |
In your comment above, do you mean "post-commit"? Or maybe "post-checkout"?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save to
.git/hooks/post-commit
and make executablechmod +x .git/hooks/post-commit
.http://stackoverflow.com/questions/1504724/a-git-hook-for-whenever-i-change-branches#answer-1810193