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.
git status --porcelain instead of git ls-files
git rev-list for ahead/behind count

git rev-list --left-right --count @{upstream}...HEAD outputs:
X   Y
where X is the number of commits the left side has ('behind,')
and Y is the number of commits the right side has ('ahead.')

This lets us get a precise count of aheads and behinds easily,
doing away with pattern matching and also letting us be a bit
more intelligent about when automatic updating is a good idea.
Merge pull request #49 from mjc/use-git-porcelain-for-git-commands-where-applicable

Use git porcelain for git commands where applicable