2024-08-06 14:01:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Avoid commits to the master branch
|
|
|
|
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
|
|
REGEX="^(master|main|staging|development)$"
|
|
|
|
|
|
|
|
if [[ "$BRANCH" =~ $REGEX ]]; then
|
|
|
|
echo "You are on branch $BRANCH. Are you sure you want to commit to this branch?"
|
|
|
|
echo "If so, commit with -n to bypass the pre-commit hook."
|
|
|
|
exit 1
|
2024-08-06 15:02:52 +00:00
|
|
|
else
|
|
|
|
npm run lint-staged
|
|
|
|
fi
|