mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
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)
This commit is contained in:
parent
3e9493fb30
commit
22cf85c0f8
1 changed files with 5 additions and 0 deletions
|
|
@ -52,6 +52,11 @@ function current_branch() {
|
||||||
echo ${ref#refs/heads/}
|
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
|
# these aliases take advantage of the previous function
|
||||||
alias ggpull='git pull origin $(current_branch)'
|
alias ggpull='git pull origin $(current_branch)'
|
||||||
compdef ggpull=git
|
compdef ggpull=git
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue