Last active
October 13, 2015 02:27
-
-
Save mindo/4124388 to your computer and use it in GitHub Desktop.
see git/mercurial branch on command 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_and_add_brackets { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\[\1\]\ /' | |
} | |
function parse_hg_branch_and_add_brackets { | |
hg branch 2> /dev/null | sed -e 's/\(.*\)/\[\1\]\ /' | |
} | |
PS1="$XTERM_TITLE$USER_COLOR\u\[\e[36;1m\]@\[\e[31;1m\]\h:\[\e[m\] \[\e[1;34m\]\w\[\e[m\]\n\[\033[0;32m\]$(parse_git_branch_and_add_brackets)$(parse_hg_branch_and_add_brackets)\[\e[36;1m\]$DOLLAR$BGJOBS \[\e[m\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment