From 22cf85c0f8d405cf0e73a6362e6c28c5c1121fab Mon Sep 17 00:00:00 2001 From: Philip Hofstetter Date: Wed, 28 Dec 2011 14:59:55 +0100 Subject: [PATCH] add function to determine current upstream for git_prompt_ahead() (in lib/git.zsh) to work with remotes different than 'origin', we need a way to determine the origin of the currently active branch. This uses git-config to find the current branches remote (if any) --- plugins/git/git.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c1b382b2c..bf6233c5d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -52,6 +52,11 @@ function current_branch() { echo ${ref#refs/heads/} } +function git_current_upstream(){ + local upstream=$(git config --get branch."$(current_branch)".remote) || return + echo $upstream +} + # these aliases take advantage of the previous function alias ggpull='git pull origin $(current_branch)' compdef ggpull=git