From be8e85b71c4e614501edeb59358ef805674f98f7 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Wed, 21 May 2014 13:12:49 +0200 Subject: [PATCH] update aliases to default to current branch, fixes #1601 --- plugins/git/git.plugin.zsh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 324b35130..f1157c5a9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -166,14 +166,25 @@ compdef git-svn-dcommit-push=git alias gsr='git svn rebase' alias gsd='git svn dcommit' # Current branch -alias ggpull='git pull origin $(current_branch)' -compdef ggpull=git -alias ggpur='git pull --rebase origin $(current_branch)' -compdef ggpur=git -alias ggpush='git push origin $(current_branch)' -compdef ggpush=git -alias ggpnp='git pull origin $(current_branch) &&git push origin $(current_branch)' -compdef ggpnp=git +ggl() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git pull origin "${b:=$1}" +} +compdef _git ggl=git-checkout +ggu() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git pull --rebase origin "${b:=$1}" +} +compdef _git ggu=git-checkout +ggp() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git push origin "${b:=$1}" +} +compdef _git ggp=git-checkout +ggpnp() { + ggl "$1" && ggp "$1" +} +compdef _git ggpnp=git-checkout # Work In Progress (wip) # These features allow to pause a branch development and switch to another one # When you want to go back to work, just unwip it