a=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ -n "$a" ]; then echo " [$a]" else echo "" fi
PS1="\u@\h:\w\$(brname)$ "
credit: daniel.haxx.se, https://news.ycombinator.com/item?id=25043731