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\$ '
}
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
Post a Comment