Skip to content

Instantly share code, notes, and snippets.

@ggaaooppeenngg
Created July 1, 2015 07:03
Show Gist options
  • Save ggaaooppeenngg/75ce761848e89df3699f to your computer and use it in GitHub Desktop.
Save ggaaooppeenngg/75ce761848e89df3699f to your computer and use it in GitHub Desktop.
PS1_git_branch
function get_git_branch()
{
branch__=
git branch &> /dev/null
if [ $? -eq 0 ]; then
branch__=`git branch --no-color | sed -ne 's/^\* \(.*\)$/\1/1p' | tr a-z A-Z`
else
branch__="NORMAL"
fi
echo -n $branch__
}
export PS1='[\w]\n\[\033[1;36m\]\u\[\033[1;33m\]->(`get_git_branch`)\[\033[0m\]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment