Last active
October 9, 2015 18:48
-
-
Save salverde/3559536 to your computer and use it in GitHub Desktop.
Display Git branch shell prompt & Autocomplete
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() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
# set the PS1 variable | |
#PS1="\w\[\e[0;33;49m\]\$(parse_git_branch)\[\e[0;0m\]$ " | |
PS1="\w\[\e[0;37m\]\$(parse_git_branch)\[\e[0;0m\]$ " | |
# Set git autocompletion and PS1 integration | |
if [ -f /usr/local/Cellar/git/2.1.3/etc/bash_completion.d/git-completion.bash ]; then | |
. /usr/local/Cellar/git/2.1.3/etc/bash_completion.d/git-completion.bash | |
fi | |
GIT_PS1_SHOWDIRTYSTATE=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment