Steps:
-
First download 'git-prompt.sh' or copy all contents. https://github.com/gaiusmathew/git-branch/blob/master/git-prompt.sh
-
Save it to a file and rename it as 'git-prompt.sh' and save it somewhere like '/home'
-
Open file '.bashrc' in home. (It is hidden, so you have to press 'ctrl+h' to see it).
-
Make sure you have permissions to that file, else give permissions by typing 'sudo chmod 777 path/.bashrc' in terminal
-
After giving permissions open '.bashrc' file in any editor and add these codes below
source /home/gaius/.git-prompt.sh parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\[\033[01;37m\]\u@\h:\[\033[01;33m\]\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\]\[\033[01;37m\]\$"
-
Save the file and restart bash again, voila..... Open your git folder to see the change.
If you get stuck anywhere report it in issues. https://github.com/gaiusmathew/git-branch/issues