I use the following entry in ~/.bashrc
file to colorize the prompt and display current branch of git repository:
PS1='\[\e[1;32m\]\[\u@\h\]\[\e[m\] \[\w\]\[\e[1;1m\]\[$(__git_ps1 " (%s)")\] \[\e[1;1m\]\[$\] \[\e[m\]'
This works almost fine, except when I use bash history (up arrow key few times), the command line becomes 'outdented' (just the first characters of the prompt remains untouched), and the visible is:
usemmand
when my username is user
and the command is command
.