Created
January 12, 2011 19:47
-
-
Save bermi/776751 to your computer and use it in GitHub Desktop.
Show your git or hg branch name on your MacOS prompt by adding this to your ~/.profile
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
parse_git_branch (){ | |
[`pwd | grep "work|Sites|Projects"` != ""] && git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git:\1)/' | |
} | |
parse_hg_branch() { | |
[`pwd | grep "work|Sites|Projects"` != ""] && hg branch 2> /dev/null | sed -e 's/\(.*\)/(hg:\1)/' | |
} | |
PS1='\[\033[0;33m\]\w\[\033[00m\]\[\033[01;00m\]$(parse_git_branch)$(parse_hg_branch): ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment