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

Comments

Popular posts from this blog

Simple Invoice Creation With Jasper Report

Dynamic Image in Jasper Report

Auto Increment Oracle Table Id Mapping With JPA Entity