From d6a219691eac00453aa470083999bfd3a5928d1a Mon Sep 17 00:00:00 2001 From: Agustin Pina Date: Tue, 3 Nov 2015 00:42:32 -0300 Subject: [PATCH] Add ggfr command to ask for rebase with master before push --force --- plugins/git/git.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d78b82df3..ff16be2e0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -102,6 +102,16 @@ ggf() { [[ "$#" != 1 ]] && local b="$(current_branch)" git push --force origin "${b:=$1}" } +ggfr() { +local answer +vared -p "Do you want to rebase first? Y/N " -c anwser +case $anwser in +[Yy]* ) git rebase master;; +[Nn]* ) :;; +* ) echo "Please answer yes or no" && return;; +esac +ggf +} compdef _git ggf=git-checkout ggl() { if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then