Skip to content

Instantly share code, notes, and snippets.

@kitop kitop/post-commit
Last active Jan 2, 2016

What would you like to do?
Git post commit hook to remind to precompile some assets
# A hook script to remind us to precompile the assets.
NC='\033[0m' # No Color
changes=$(git diff --name-only HEAD^)
echo $changes | grep ^app/assets > /dev/null
echo $changes | grep ^public/assets > /dev/null
# here we check if any asset changend, and if there are no precompiled assets
if [ $assets_changed -eq 0 -a $assets_precompiled -eq 1 ]; then
echo -e "${color}HEADS UP!${NC}"
echo "Seems you’ve changed some assets but didn’t add any precompiled ones."
echo "Don't forget to precompile them before deploying!"
echo "---------------------------------------------------------------------"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.