From c5cf78510a9c926d3da4f526c33ad64c1539ca37 Mon Sep 17 00:00:00 2001 From: Pablo Baleztena Date: Wed, 18 Sep 2024 22:46:53 -0300 Subject: [PATCH] Update git hooks to protect main branch and force good practices --- .husky/pre-commit | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 9348d24..c43da26 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,9 @@ # .husky/pre-commit -yarn lint-staged \ No newline at end of file +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 \ No newline at end of file