galfert (owner)

Revisions

gist: 129157 Download_button fork
public
Description:
Show the git branch in bash prompt
Public Clone URL: git://gist.github.com/129157.git
Embed All Files: show embed
bash_profile_git_branch.sh #
1
2
3
4
5
6
7
8
9
10
11
function parse_git_branch {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
 
GREEN="\[\033[01;32m\]"
WHITE="\[\033[00m\]"
BLUE="\[\033[01;34m\]"
YELLOW="\[\033[0;33m\]"
 
PS1="$GREEN\u@\h$WHITE:$BLUE\w $YELLOW\$(parse_git_branch)$WHITE\$ "