To show on which git branch you are working currently

function parse_git_branch () {
git branch 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/ (\1)/’
}

RED=”\[33[0;31m\]”
YELLOW=”\[33[0;33m\]”
GREEN=”\[33[0;32m\]”
NO_COLOR=”\[33[0m\]”

PS1=”\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ ”

 

 

if you are Mac user paste the above code in .profile file of the current user of your system home directory

if you are Linux user the paste it in the .bashrc file of the current user of your system home directory

Leave a comment