Created
December 19, 2010 20:20
-
-
Save philchristensen/747661 to your computer and use it in GitHub Desktop.
add current git branch to shell 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/} | |
} | |
export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_git_branch)\[\e[0m\] \$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To make this update on every prompt (like when changing dirs), you'll want to tie it into PROMPT_COMMAND