-
-
Save SuperSandro2000/4e5d640865de4a04c2e3ec782f56a473 to your computer and use it in GitHub Desktop.
Git: replace --force with --force-with-lease
This file contains 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() { | |
case "$1" in | |
"push") | |
shift | |
local command | |
command=() | |
# loop trough all vars or once when no other arguments except push are given | |
while [[ $# -gt 0 ]]; do | |
case "$1" in | |
"-f" | "--force") | |
command+=("--force-with-lease") | |
;; | |
*) | |
command+=("$1") | |
;; | |
esac | |
shift | |
done | |
command git push "${command[@]}" | |
;; | |
*) | |
command git "${@:-"--help"}" | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment