Created
August 8, 2012 19:00
-
-
Save lvidarte/3297587 to your computer and use it in GitHub Desktop.
Descubrir el branch actual de git y si hay cambios
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
function get_git_branch () | |
{ | |
DIRTY="" | |
CLEAN="nothing to commit (working directory clean)" | |
[ "`git status 2> /dev/null | tail -n1`" != "$CLEAN" ] && DIRTY='*' | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/⚡\1$DIRTY/" | |
} | |
PS1='\h \W$(get_git_branch)\$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment