I tried to integrate the current git branch in my prompt, but it doesn't behave as expected. I'm using bash on ubuntu 16.04 and git 2.7.4.
When I start a terminal nothing of git is shown. If I source my .bashrc
from inside a repository the branch is shown, but doesn't update anymore. This is what I wrote in my .bashrc:
green="\[\033[01;32m\]"
blue="\[\033[01;34m\]"
no_color="\[\033[00m\]"
purple="\[\033[01;35m\]"
source ~/.git-prompt.sh
export PS1="$purple\u $green$(__git_ps1 " (%s)") $blue\W $no_color \$ "
Update:
I tried follow the instructions in git-prompt but still the same result. However if I just copy the suggestion from git-prompt: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
it works, but of course doesn't look like I want. Is there some syntax error I'm missing?
The template PS1 works even if don't use export, just PS1=...