Skip to content

Instantly share code, notes, and snippets.

@lvidarte
Created August 8, 2012 19:00
Show Gist options
  • Save lvidarte/3297587 to your computer and use it in GitHub Desktop.
Save lvidarte/3297587 to your computer and use it in GitHub Desktop.
Descubrir el branch actual de git y si hay cambios
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