You use a custom git parse branch, while git has a much more powerful prompt function : __git_ps1 . It's readily available in git's default bash_completion.d file.
It shows the current branch, but also the state of the git tree (during rebase, am, bisecting, cherry-picking, etc.)