Skip to content

Commit

Permalink
chore: forbidden push to master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Dec 19, 2019
1 parent cee0764 commit 4a7780f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,7 +30,8 @@
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged && lerna run --concurrency 1 --stream precommit"
"pre-commit": "lint-staged && lerna run --concurrency 1 --stream precommit",
"prepush": "./scripts/pre-push-check.sh"
}
},
"lint-staged": {
Expand Down
9 changes: 9 additions & 0 deletions scripts/pre-push-check.sh
@@ -0,0 +1,9 @@
#!/bin/sh

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "master" ]; then
echo "Push to master branch is forbidden."
echo "Checkout your owne branch then submit a pr."
exit 1
fi

0 comments on commit 4a7780f

Please sign in to comment.