|
|
|
|
|
by chrismorgan
216 days ago
|
|
> ⬆ - Ahead of remote > ⬆⬆ - Diverged from remote This is an obscure and confusing way of representing it. At the very least, I’d expect the addition of ⬇ to mean behind remote, and then ⬇⬆ to mean diverged (since it is logically just “both behind and ahead”). For my part, I prefer a notation like “-4+5” to mean “4 commits behind, 5 commits ahead”, produced in this way in my $RPROMPT: commits_behind=$(git log --oneline ..@{u} 2> /dev/null | wc -l || echo 0)
commits_ahead=$(git log --oneline @{u}.. 2> /dev/null | wc -l || echo 0)
if [ $commits_behind -gt 0 -o $commits_ahead -gt 0 ]; then
echo -n " %{\x1b[33m%}"
[ $commits_behind -gt 0 ] && echo -n -$commits_behind
[ $commits_ahead -gt 0 ] && echo -n +$commits_ahead
fi
|
|