Created
September 9, 2022 19:04
-
-
Save st0le/ce69371a28528fc9fd0f38d7ee0e3d7a to your computer and use it in GitHub Desktop.
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 | |
branch="$(git rev-parse --abbrev-ref HEAD)" | |
if [ "$branch" = "master" ]; then | |
echo "You can't commit directly to master branch" | |
exit 1 | |
fi | |
git diff --cached --name-status | while read flag file; do | |
if [ "$flag" == 'D' ]; then continue; fi | |
if egrep -q "NOSHIP" "$file"; then | |
echo "ERROR: Disallowed expression \"NOSHIP\" in file: ${file}" >&2 | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment