1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

lib/git.zsh: Added git_commits_behind function (#4450)

* Added git_commits_behind function
* Added 'command' to git_commits_behind function
* git_commits_behind code review changes
This commit is contained in:
Steven 2016-07-15 02:05:39 -07:00 committed by Marc Cornellà
parent 644bc641ad
commit 96a2092e37

View file

@ -83,6 +83,13 @@ function git_commits_ahead() {
fi fi
} }
# Gets the number of commits behind remote
function git_commits_behind() {
if $(command git rev-parse --git-dir > /dev/null 2>&1); then
echo $(git rev-list --count HEAD..@{upstream})
fi
}
# Outputs if current branch is ahead of remote # Outputs if current branch is ahead of remote
function git_prompt_ahead() { function git_prompt_ahead() {
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then