Skip to content

Instantly share code, notes, and snippets.

@liuzhoou
Created February 10, 2009 03:41
Show Gist options
  • Save liuzhoou/61220 to your computer and use it in GitHub Desktop.
Save liuzhoou/61220 to your computer and use it in GitHub Desktop.
my git shell prompt
parse_git_branch() {
RSLT=''
GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' | awk '{print $2}'`
if [ "$GIT_BRANCH" ]
then
GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'`
CLR='2'
if [ "$GIT_STATUS" ]
then
CLR='2'
else
CLR='1'
fi
RSLT="^[[3${CLR};40m[${GIT_BRANCH}]^[[0m"
fi
echo $RSLT
}
PS1="\w\$(parse_git_branch) $ "
alias ls="ls -G"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment