Created
June 16, 2016 20:52
-
-
Save souenzzo/4a85b0ed9bee85cbab3851a88d0b804f to your computer and use it in GitHub Desktop.
Exibe branch no prompt do bash, muda de cor quando há mudanças não commitadas.
This file contains hidden or 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