Browse Source

git ahead count

master
pvincent 6 years ago
parent
commit
29e83a2dcb
  1. 17
      bash.bashrc

17
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

Loading…
Cancel
Save