Skip to content

Instantly share code, notes, and snippets.

@souenzzo

souenzzo/.bashrc

Created Jun 16, 2016
Embed
What would you like to do?
Exibe branch no prompt do bash, muda de cor quando há mudanças não commitadas.
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
You can’t perform that action at this time.