use the current branch for checking if there is pending commits
This commit is contained in:
parent
427c29258e
commit
f10a421d3f
1 changed files with 5 additions and 4 deletions
9
.bashrc
9
.bashrc
|
|
@ -104,11 +104,12 @@ git_branch_color()
|
|||
|
||||
color=""
|
||||
if git diff --quiet 2>/dev/null >&2 ; then
|
||||
has_commit=`git rev-list origin/master..master`
|
||||
if [ "$has_commit" == "" ] ; then
|
||||
color="${green}" # nothing to commit or push
|
||||
else
|
||||
branch=$(git_branch)
|
||||
has_commit=`git rev-list origin/$branch..$branch`
|
||||
if [ "$has_commit" != "" ] ; then
|
||||
color="${yellow}" # some commits to push
|
||||
else
|
||||
color="${green}" # nothing to commit or push
|
||||
fi
|
||||
else
|
||||
color="${red}" # changes to commit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue