Created
December 22, 2010 02:01
-
-
Save bryfox/750959 to your computer and use it in GitHub Desktop.
Add branch names for git & hg repos to 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
# add to .bash_profile or somesuch | |
hg_branch() { | |
hg branch 2> /dev/null | awk '{print "(hg:"$1")"}' | |
} | |
git_branch() { | |
git branch 2> /dev/null | head -1 | awk '{print "(git:"$2$3")"}' | |
} | |
export PS1='\[\033[38m\]\u@\h\[\033[01;32m\] \w \[\033[31m\]$(hg_branch)$(git_branch)\[\033[37m\] $\[\033[00m\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment