Skip to content

Instantly share code, notes, and snippets.

@vaijab
Created March 22, 2013 13:09
Show Gist options
  • Save vaijab/5221123 to your computer and use it in GitHub Desktop.
Save vaijab/5221123 to your computer and use it in GitHub Desktop.
# shows git branch if any
function git_branch {
if [[ -x /usr/bin/git ]]; then
git branch &> /dev/null
if [[ $? == 0 ]]; then
branch=$(git branch | awk '/^\* / {print $2}')
echo -n "($branch) "
fi
fi
}
PS1='\[\e[32m\][\[\e[35m\]$(git_branch)\[\e[32m\]\u\[\e[34m\]@\[\e[32m\]\h \[\e[34m\]\W\[\e[32m\]]\$\[\e[0m\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment