Skip to content

Commit

Permalink
add an indicator that says i need to push
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanl committed Apr 2, 2009
1 parent 4f2c535 commit f6c3ca9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 06_git
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ if [[ -x `which git` ]]; then
git checkout "${branch}"
git rebase master
}
function git-need-to-push() {
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
echo "↑ "
fi
}
function git-prompt() {
gstatus=$(git status 2> /dev/null)
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
if [[ x$branch != x ]]; then
dirty_color=$fg[green]
push_status=$(git-need-to-push)
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} "
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
fi
}
function git-scoreboard () {
Expand Down

0 comments on commit f6c3ca9

Please sign in to comment.