Sfoglia il codice sorgente

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

Neeraj Gupta 1 anno fa
parent
commit
bfc92713c9
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      .husky/pre-commit

+ 7 - 0
.husky/pre-commit

@@ -1,4 +1,11 @@
 #!/bin/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