Created
October 24, 2025 05:48
-
-
Save secf4ult/4e24fd68ab9e5854d2e84a6e7bf1adc8 to your computer and use it in GitHub Desktop.
Git hooks
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
| #!/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