Skip to content

Commit 6a4f552

Browse files
authored
chore: add pre-push hook to prevent direct pushes to main (#5582)
1 parent 662be08 commit 6a4f552

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.husky/pre-push

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
protected_branch='main'
3+
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
4+
5+
if [ "$current_branch" = "$protected_branch" ]; then
6+
echo "🚫 Direct push to main blocked!"
7+
echo "Create a feature branch and open a PR instead."
8+
exit 1
9+
fi
10+
11+
exit 0

0 commit comments

Comments
 (0)