Show GIT branch on CLI
Add the following code in ~/.bashrc
alias ls='ls --color=auto'
PS1="\[\e[1;32m\][\u@\h \W]\$(parse_git_branch)\[\e[0m\] "
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
Type the following command to see the GIT branch name.
source ~/.bashrc
alias ls='ls --color=auto'
PS1="\[\e[1;32m\][\u@\h \W]\$(parse_git_branch)\[\e[0m\] "
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
Type the following command to see the GIT branch name.
source ~/.bashrc
Comments
Post a Comment