Created
April 4, 2014 09:26
-
-
Save valakirka/9971138 to your computer and use it in GitHub Desktop.
Bash prompt git branch
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
# Show active Git branch # | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
# Example of prompt, full reference -> http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html # | |
export PS1="\u@\h:\w\$(git_branch)$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment