Add git information to your bash prompt

To show git information in your bash prompt, add the following function in your ~/.bashrc

function git-shell() {
  export GIT_PS1_SHOWDIRTYSTATE=1
  export PS1='\[\033[01;33m\] (git) \[\033[01;34m\]\w$(__git_ps1 " \[\033[01;32m\](%s)")\[\033[00m\]\n\$ '
}

Then, in your bash, run "git-shell" and you will get a nice git prompt:

 (git) /path_to_your_git_project (master *)
$ 

Comments

Popular posts from this blog

Java encoding : UTF-8, Big5, x-MS950-HKSCS