Created
February 17, 2011 14:35
-
-
Save marioestrada/831832 to your computer and use it in GitHub Desktop.
Shows the current working branch on the prompt with the corresponding revision control software (Mercurial or Git).
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
# Modify prompt | |
function bash_git_branch | |
{ | |
git branch 2> /dev/null | grep \* | python -c "print '[git:'+raw_input()[2:]+']'" 2> /dev/null | |
} | |
function bash_hg_branch | |
{ | |
hg branch 2> /dev/null | python -c "print '[hg:' + raw_input()[0:] + ']'" 2> /dev/null | |
} | |
# PS1 = "\h:\W \u\$ " | |
export PS1="\[\e[1;31m\]\h\[\e[m\]:\[\e[1;34m\]\W \[\e[1;33m\]\$(bash_git_branch)\$(bash_hg_branch)\[\e[m\]\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment