Last active
October 27, 2020 20:05
-
-
Save lunfel/6023547c418a242df11c18b4d0709bf1 to your computer and use it in GitHub Desktop.
Git proxy script to prevent accidentally checking out to another branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This will not block non-interractive shell execution | |
if [ ! -z "$PS1" ]; then | |
command git $@ | |
exit 0 | |
fi | |
case $1 in | |
checkout) | |
echo "prevented execution of git checkout" | |
exit 1 | |
;; | |
esac | |
# https://www.cyberciti.biz/faq/ignore-shell-aliases-functions-when-running-command/ | |
command git $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment