Created
February 27, 2023 16:55
-
-
Save leite08/f1c3131d348d5f3d1e92981c0e4361a1 to your computer and use it in GitHub Desktop.
Husky git hook to notify about changes on files/folders upon merge
This file contains 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 | |
. "$(dirname "$0")/_/husky.sh" | |
# Place this on ./husky and make sure the file is executable (chmod 770 post-merge) | |
changed() { | |
git diff --name-only HEAD@{1} HEAD | grep "$1" > /dev/null 2>&1 | |
} | |
echo "Checking updates on <file-type> files..." | |
if changed 'folder/file' || changed 'folder/file'; then | |
echo " " | |
echo "⚠ One or more change on <file-type> files. <anything-that-should-be-done?> | |
echo " " | |
else | |
echo "No updates detected on <file-type> files." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment