Skip to content

Instantly share code, notes, and snippets.

@secf4ult
Created October 24, 2025 05:48
Show Gist options
  • Select an option

  • Save secf4ult/4e24fd68ab9e5854d2e84a6e7bf1adc8 to your computer and use it in GitHub Desktop.

Select an option

Save secf4ult/4e24fd68ab9e5854d2e84a6e7bf1adc8 to your computer and use it in GitHub Desktop.
Git hooks
#!/usr/bin/bash
properties=$(git diff --cached --name-only | grep -E '.*\.properties')
# make git hook can read user input
exec < /dev/tty
if [[ -n "$properties" ]];then
while IFS= read -r f;do
printf ' - %s\n' "$f"
done <<< "$properties"
echo
while true; do
read -p "There are properties file to be committed, are you sure? " yn
yn=${yn:-n}
case "$yn" in
[Yy])
exit 0;;
[Nn])
exit 1;;
esac
done
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment