Wednesday, July 6, 2011

git branch in the shell

Add this to  ~/.bash_profile:

#Show the current git branch in the path
# \[\033[0;32m\] : sets color to green
# \[\033[0m\]    : reset to default color
PS1='\u@\h:\W\[\033[0;32m\]$( git branch 2> /dev/null | cut -f2 -d\* -s | sed "s/^ /#/" )\[\033[0m\]\$ '

the current git branch will be highlighted in the shell

username@hostname:directory#master

Bash colors: http://ubuntuforums.org/archive/index.php/t-31247.html

No comments:

Post a Comment