Created
January 18, 2012 07:12
-
-
Save antris/1631742 to your computer and use it in GitHub Desktop.
Show git or Mercurial branch 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
hg_branch() { | |
test -e .hg/branch && echo " hg:$(cat .hg/branch)" | |
} | |
git_branch() { | |
test -e .git && git branch | grep \* | awk '{ printf " git:" substr($0, index($0,$2)) }' | |
} | |
export PS1='\h:\w$(hg_branch)$(git_branch) $ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment