Cool colours and GitHub branch in Terminal
15 Jun 2009There are many posts out there about making terminal have nice colours and getting it to display your projects GitHub branch. So l thought l would post mine
Here is what my terminal looks like.
Yes l am using Ryan Bates railscasts as my sample project (Thanks Ryan). As you can see it has the username@machine and then if you are in a project running git is also has the branch.
All you need to do it add the following to either your bash_login or bash_profile depending on what you are using. So first you run
mate ~/.bash_login
I am using textmate to edit this file. Once there simple add the following
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=gxfxcxdxbxegedabagacad # cyan directories
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ \`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[37m\]$\[\033[00m\] "
Save the file and reload your bash like so and you are good to go enjoy.
ruby
. ~/.bash_login
Of course you can change the colour of the font but ill leave that to you