Manual merge of git status line for the terminal from @nvandijk and also ported this concept to hg