I would like to extract the information that is printed after a git status, which looks like:
git status
# On branch master # Your branch is ahead of \'origin/
You can try git branch -v -v. With -v flag given twice, it outputs names of upstream branches. Sample output:
git branch -v -v
-v
* devel 7a5ff2c [origin/devel: ahead 1] smaller file status overlay icons master 37ca389 [origin/master] initial project check-in.
I think this format is more stable than git status output.