1 - Delimit the branch name with brackets instead of parens
Here is a relevant passage of the .git-prompt.sh file (which, in modern Git versions, contains the definition of the __git_ps1 function):
# 3a) Change your PS1 to call __git_ps1 as # command-substitution: # Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' # ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' # the optional argument will be used as format string.
__git_ps1 accepts an optional argument that you can use to customize the format of the string. In your case, you should use
PS1="\u@\h \W \$(__git_ps1 '[%s]')\$ "
2 - Using colors
You can use colors as in the code in your question, but you need to make sure that the variables in question are defined. Put the following lines somewhere in your ~/.bashrc file:
RED=$(tput setaf 1) GREEN=$(tput setaf 2) YELLOW=$(tput setaf 3) BLUE=$(tput setaf 4) MAGENTA=$(tput setaf 5) WHITE=$(tput setaf 7) RESET=$(tput setaf 0)
After sourcing your ~/.bashrc file, you'll be able to use those colors. For instance, here is a simplified version of your prompt with the current branch name (and surrounding brackets) highlighted in red:
PS1="\W \[$RED\$(__git_ps1 '[%s]')\]\[$RESET\$\] "

PS1="\u@\h \W \$(__git_ps1 "[%s]")\$ "instead.linuxtag and thegit-bashtag. Are you using Git on Windows or Linux?