Use git porcelain for git commands where applicable

- Use ``` git symbolic-ref --short --quiet HEAD``` to get the name of the current branch to avoid parsing text and dealing with colors.
- Use ``` git rev-parse --verify --quiet @{upstream}``` to get the remote tracking branch.
- Use ``` git status --porcelain``` to get the list of changed files for dirty check.
- Use ``` git rev-list --left-right --count @{upstream}...HEAD``` (note the triple-dots instead of double-dots) to get behind/ahead counts, and thus avoid regexp parsing.