Created
April 23, 2009 08:20
-
-
Save stubbetje/100389 to your computer and use it in GitHub Desktop.
show git branch and dirty state in bash prompt
This file contains 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
#!/bin/bash | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; | |
} | |
parse_git_dirty() { | |
[[ ! $(git status) =~ "nothing to commit (working directory clean" ]] && echo " ⚡ " | |
} | |
export PS1='\[\033[01;30m\] [$(parse_git_branch)\[\033[01;33m\]$(parse_git_dirty)\[\033[01;30m] \[\033[00m\]'$PS1 | |
export LESS="$LESS -R" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment