Thursday, July 16, 2020

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 *)
$ 

No comments:

Post a Comment

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...