Created
March 12, 2012 21:41
-
-
Save saranrapjs/2024853 to your computer and use it in GitHub Desktop.
Git status 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
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}") " | |
} | |
YELLOW="\[\033[0;33m\]" | |
PS1="\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)\[\e[m\]\$ " |
add to your .bash_profile !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
based on http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
using 1.7.9 (though I believe the above git syntax requires >1.6 )