Last active
November 8, 2024 01:32
-
-
Save reececomo/f2c299cae91c96dacd8d62ff44fa47a2 to your computer and use it in GitHub Desktop.
protect git push -f
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
| git() { | |
| WARN='\033[0;33m' | |
| RESET='\033[0m' | |
| if [[ "$1" == "push" && "$2" == "-f" ]]; then # idiot safety net | |
| echo -e "${WARN}note: running with --force-with-lease. run with \"--force\" to override.${RESET}" | |
| command git push --force-with-lease "${@:3}" | |
| else | |
| command git "$@" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment