Skip to content

Instantly share code, notes, and snippets.

@vidmantas
Created April 20, 2011 13:50
Show Gist options
  • Save vidmantas/931379 to your computer and use it in GitHub Desktop.
Save vidmantas/931379 to your computer and use it in GitHub Desktop.
git console status
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
branch_status () {
if git rev-parse --git-dir >/dev/null 2>&1
then
status=""
if git diff --quiet 2>/dev/null >&2
then
status=""
else
status="⚡"
fi
else
return 0
fi
echo -ne $status
}
PS1="\w\[\e[0;32m\]\$(parse_git_branch)\$(branch_status)\[\e[0m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment