diff options
author | Steven <stevenspasbo@gmail.com> | 2016-07-15 02:05:39 -0700 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2016-07-15 11:05:39 +0200 |
commit | 96a2092e377139fbcd95d7b7ac703b740daa22f6 (patch) | |
tree | 95b58cb81e7561e868068c9237fcb5e5d296bbab /lib | |
parent | 644bc641ad48c74c88631d79d48ec9b6f3f5a3e5 (diff) | |
download | zsh-96a2092e377139fbcd95d7b7ac703b740daa22f6.tar.gz zsh-96a2092e377139fbcd95d7b7ac703b740daa22f6.tar.bz2 zsh-96a2092e377139fbcd95d7b7ac703b740daa22f6.zip |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/git.zsh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/git.zsh b/lib/git.zsh index 1c76d5882..c79cc0d8e 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -83,6 +83,13 @@ function git_commits_ahead() { 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 function git_prompt_ahead() { if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then |