Created
July 6, 2011 11:55
-
-
Save gaveen/1067055 to your computer and use it in GitHub Desktop.
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
# .bashrc | |
# Cool bash prompt (with git goodness) | |
function parse_git_branch { | |
BRANCH_PROMPT=$(__git_ps1) | |
if [ -n "$BRANCH_PROMPT" ]; then | |
BR_GIT_STATUS=$(get_git_status) | |
echo $BRANCH_PROMPT$BR_GIT_STATUS | |
fi | |
} | |
function get_git_status() { | |
if current_git_status=$(git status | grep 'be committed' 2> /dev/null); then | |
echo "✗" | |
fi | |
} | |
PS1="\[\033[1;32m\][\u@\h \W\[\033[0;33m\]\$(parse_git_branch)\[\033[1;32m\]]\$\[\033[0m\] " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Decided to go with:
Yours is simpler. Anyway I chose to run __git_ps1 only on dirs with a './.git' dir (eventhough __git_ps1 can handle that). Plus this way gets rid of the leading space. Now that I got the bike-shed done, going back to work. :)