Use git symbolic-ref to get branch name

git symbolic-ref --quiet --short will print the short branch name
without color codes.  It will return exit code 1 in the case of being in
a detached HEAD state.
Don't strip color codes that no longer exist
Discover remote tracking branch via @{upstream}

Git 1.6.6.1 and later support this notation for finding the upstream
branch.

This is useful because one might not be tracking origin/branchname.