Much-improved git prompt function

Thanks to @necolas:

<https://github.com/necolas/dotfiles/blob/master/bash/bash_prompt#L60-L111>