feat(git)!: ask for confirmation in gpf alias, and add gpff alias without prompt

- Rename `git push --force-with-lease ...` to `gpff`
- Add a y/n confirmation prompt to `gpf` before running `git push --force-with-lease ...`

BREAKING CHANGE: this change adds a confirmation prompt to the `gpf` alias before
running the potentially destructive `git push --force-with-lease` command. If you
want to force-run the command without having to confirm it, run `gpff`.
This commit is contained in:
Marc Cornellà 2024-08-15 16:42:04 +02:00
commit 7ee55c8ad2
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
2 changed files with 11 additions and 6 deletions

View file

@ -297,10 +297,13 @@ function ggf() {
}
compdef _git ggf=git-checkout
alias gpf!='git push --force'
alias 'gpf!'='git push --force'
is-at-least 2.30 "$git_version" \
&& alias gpf='git push --force-with-lease --force-if-includes' \
|| alias gpf='git push --force-with-lease'
&& alias gpf='read -k 1 -q "?Continue force-push? [y/N] " && echo && git push --force-with-lease --force-if-includes' \
|| alias gpf='read -k 1 -q "?Continue force-push? [y/N] " && echo && git push --force-with-lease'
is-at-least 2.30 "$git_version" \
&& alias gpff='git push --force-with-lease --force-if-includes' \
|| alias gpff='git push --force-with-lease'
function ggfl() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"