Last active
August 29, 2015 14:06
-
-
Save rafi/a97c50d0f964354e8362 to your computer and use it in GitHub Desktop.
Git hooks maintenance
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
# Iterate and delete all hook files from git projects and submodules (only if there's ".git" in path) | |
find . -name 'post-*' | grep 'hooks/' | grep '.git' | sed 's/hooks\/.*$/hooks/g' | while IFS= read -r dir; do rm $dir/*; done; | |
# Copy your git template's hooks into all projects and submodules (only if there's ".git" in path) | |
find . -name 'hooks' -type d | grep '.git' | while IFS= read -r dir; do cp ~/.config/git/template/hooks/* $dir/; done; | |
# Copy your git template's hooks into a single project | |
cp ~/.config/git/template/hooks/* .git/hooks/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment