Report abuse


			
export PINK="^[[0;31m"
export GREEN="^[[0;32m"
export YELLOW="^[[0;33m"
export SLATE="^[[0;34m"
export ORANGE="^[[0;35m"
export BLUE="^[[0;36m"
export NOCOLOR="^[[0m"

git_current_branch()
{
  git branch 2>/dev/null | sed -n '/^\*/ s/^\* //p'
}

git_display()
{
  br=$(git_current_branch)
  if [ -n br ]; then
      echo $br | BRANCH="$br" GIT_COLOR=$(git_color) awk '{if ($1) { print ENVIRON["GIT_COLOR"] ENVIRON["BRANCH"] " " } }'
  fi
}

git_color()
{
    git status 2>/dev/null | grep -c : | awk '{if ($1 > 0) { print ENVIRON["ORANGE"] } else { print ENVIRON["PINK"] } }'
}

PS1="[\$(git_display)$GREEN\w$NOCOLOR]\n\u@\h("'$?'") \$ "