mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-10-16 11:40:46 +00:00
Compare commits
3 commits
bf78ab0f11
...
6400206ad3
Author | SHA1 | Date | |
---|---|---|---|
|
6400206ad3 | ||
|
367e9381df | ||
|
d7c1e0404a |
1 changed files with 9 additions and 1 deletions
10
lib/git.zsh
10
lib/git.zsh
|
@ -163,7 +163,7 @@ function git_current_branch() {
|
|||
}
|
||||
|
||||
# Outputs the name of the previously checked out branch
|
||||
# Usage example: git pull origin $(git_current_branch)
|
||||
# Usage example: git pull origin $(git_previous_branch)
|
||||
# rev-parse --symbolic-full-name @{-1} only prints if it is a branch
|
||||
function git_previous_branch() {
|
||||
local ref
|
||||
|
@ -195,6 +195,14 @@ function git_commits_behind() {
|
|||
fi
|
||||
}
|
||||
|
||||
function git_commits_status() {
|
||||
local ahead=$(git_commits_ahead)
|
||||
local behind=$(git_commits_behind)
|
||||
if [[ -n "$ahead$behind" ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_STATUS_PREFIX$ahead$behind$ZSH_THEME_GIT_COMMITS_STATUS_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
|
|
Loading…
Reference in a new issue