I created my own version for displaying the git branch in prompt starting from @vankasteelj reply (wrote on Mar 7, 2016).
It is a simple solution that includes branch status color. Take a look:
parse_git_bg() {
if [[ $(git status -s 2> /dev/null) ]]; then
echo -e "\033[0;31m"