Created
April 25, 2014 21:12
-
-
Save botandrose/11303438 to your computer and use it in GitHub Desktop.
git 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
# shove this in your .bashrc or .bash_profile or whatever | |
function parse_git_dirty { | |
[[ $(git ls-files -o -m --exclude-standard 2> /dev/null) != "" ]] && echo "*" | |
} | |
function parse_git_branch { | |
if type -p __git_ps1; then | |
branch=$(__git_ps1 '%s') | |
if [ -n "$branch" ]; then | |
echo -e "[$branch]" | |
fi | |
fi | |
} | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;32m\]$(parse_git_branch)\[\033[1;31m\]$(parse_git_dirty)\[\033[00m\]\$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment