Selaa lähdekoodia

Merge pull request #272 from ente-io/block-commit-on-main-locally

Neeraj Gupta 1 vuosi sitten
vanhempi
commit
bfc92713c9
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      .husky/pre-commit

+ 7 - 0
.husky/pre-commit

@@ -1,4 +1,11 @@
 #!/bin/sh
 #!/bin/sh
 . "$(dirname "$0")/_/husky.sh"
 . "$(dirname "$0")/_/husky.sh"
 
 
+branch="$(git rev-parse --abbrev-ref HEAD)"
+
+if [ "$branch" = "main" ]; then
+  echo "You can't commit directly to main branch"
+  exit 1
+fi
+
 npx lint-staged
 npx lint-staged