We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3432fcc commit 018e277Copy full SHA for 018e277
.husky/pre-push
@@ -0,0 +1,23 @@
1
+#!/bin/sh
2
+. "$(dirname "$0")/_/husky.sh"
3
+
4
+RED="\033[1;31m"
5
+NO_COLOR="\033[0m"
6
7
+BRANCH=`git rev-parse --abbrev-ref HEAD`
8
+PROTECTED_BRANCHES="^(trunk|develop|release/*)"
9
10
+# Only show warning for 'develop', 'trunk' and 'release/...' branches.
11
+if ! [[ "$BRANCH" =~ $PROTECTED_BRANCHES ]]; then
12
+ exit 0
13
+fi
14
15
+# Ask for confirmation, anything other than 'y' or 'Y' is considered as a NO.
16
+echo "\nYou're about to push to ${RED}${BRANCH}${NO_COLOR} 😱, is that what you intended? [y|n] \c"
17
+read -n 1 -r < /dev/tty
18
+echo "\n"
19
+if echo $REPLY | grep -E '^[Yy]$' > /dev/null; then
20
21
22
23
+exit 1
0 commit comments