mirror of
https://github.com/purhan/dotfiles.git
synced 2025-12-26 14:24:58 +08:00
17 lines
458 B
Bash
Executable file
17 lines
458 B
Bash
Executable file
#!/bin/bash
|
|
|
|
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
|
protected_branches="main master dev"
|
|
|
|
if [[ "$protected_branches" == *"$current_branch"* ]];
|
|
then
|
|
read -p "You're about to push master, is that what you intended? [y|N] " -n 1 -r < /dev/tty
|
|
echo
|
|
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
|
|
then
|
|
exit 0 # push will execute
|
|
fi
|
|
exit 1 # push will not execute
|
|
else
|
|
exit 0 # push will execute
|
|
fi
|