From 1a56aae1af3855ba31382c608f38b535a7254a7a Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 28 Apr 2012 00:02:21 +0200 Subject: [PATCH] prompt bugfix: show git branch name in yellow iff there is pending commits to push --- .bashrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index 7b39028..f127545 100644 --- a/.bashrc +++ b/.bashrc @@ -95,10 +95,11 @@ git_branch_color() color="" if git diff --quiet 2>/dev/null >&2 ; then - if git rev-list --quiet origin/master..master 2>&1 >/dev/null ; then - color="${yellow}" # some commits to push - else + has_commit=`git rev-list origin/master..master` + if [ "$has_commit" == "" ] ; then color="${green}" # nothing to commit or push + else + color="${yellow}" # some commits to push fi else color="${red}" # changes to commit