Created
July 1, 2015 07:03
-
-
Save ggaaooppeenngg/75ce761848e89df3699f to your computer and use it in GitHub Desktop.
PS1_git_branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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