Created
June 16, 2016 20:52
Star
You must be signed in to star a gist
Exibe branch no prompt do bash, muda de cor quando há mudanças não commitadas.
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
git_branch() { | |
GIT_STATUS="$(git status --porcelain 2> /dev/null)" | |
(( $? == 0 )) || return | |
if [[ -z "$GIT_STATUS" ]]; then | |
tput setaf 6 | |
else | |
tput setaf 5 | |
fi | |
git branch 2> /dev/null \ | |
| awk '/^\*/{print "("$2")"}' | |
} | |
# PS1='[\u@\h \W]\$ ' | |
PS1='\W$(git_branch) ' | |
PS1='\[\e[1;32m\]'"$PS1"'\[\e[0m\]' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment