diff --git a/bash.bashrc b/bash.bashrc index 4d2257a..b9cdce5 100644 --- a/bash.bashrc +++ b/bash.bashrc @@ -78,16 +78,23 @@ __prompt_command() { if hash git 2>&-; then # git command exists + if git rev-parse --git-dir > /dev/null 2>&1; then # current dir is version controlled - branch=$(git branch 2> /dev/null | grep -e ^* | cut -d ' ' -f2) + local branch=$(git branch 2> /dev/null | grep -e ^* | cut -d ' ' -f2) PS1+=" ${R}[${Mag}${branch}${R}|" - dirty=$(git status -s | wc -l) - if [ $dirty == 0 ]; then - PS1+="${Gre}✔" - else + local dirty=$(git status -s | wc -l) + if [ $dirty > 0 ]; then PS1+="${Mag}…$dirty" + else + local ahead=$(git rev-list --branches --not --remotes) + echo $ahead + if [ $ahead > 0 ]; then + PS1+="${Blu}↑${ahead}" + else + PS1+="${Gre}✔" + fi fi PS1+="${R}]" fi