Update git hooks to protect main branch and force good practices
This commit is contained in:
parent
3713812956
commit
e96a8aa85c
@ -1,2 +1,9 @@
|
|||||||
# .husky/pre-commit
|
# .husky/pre-commit
|
||||||
yarn lint-staged
|
yarn lint-staged
|
||||||
|
|
||||||
|
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
|
||||||
|
if [ "$branch" = "main" ]; then
|
||||||
|
echo "You can't commit directly to main branch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
12
.husky/pre-push
Normal file
12
.husky/pre-push
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# .husky/pre-push
|
||||||
|
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
|
||||||
|
while read local_ref local_sha remote_ref remote_sha
|
||||||
|
do
|
||||||
|
echo $local_ref
|
||||||
|
echo $local_sha
|
||||||
|
echo $remote_ref
|
||||||
|
echo $remote_sha
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
Loading…
Reference in New Issue
Block a user