Created
October 23, 2014 00:18
-
-
Save mgalushka/7e13304578b66e650449 to your computer and use it in GitHub Desktop.
Display branch/bookmark for both git/mercurial in command prompt
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
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
function hg_branch() { | |
#hg branch 2> /dev/null | awk '{ printf "\033[37;0m\033[35;40m" $1 }' | |
hg bookmarks 2> /dev/null | awk '/\*/ { printf " (" $2 ")"}' | |
} | |
PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$YELLOW\$(hg_branch)$NO_COLOR\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment