Here git statusgets this information.
Which branch are we in?
$ git symbolic-ref --short HEAD
1.8.x
(the above is the preferred search method, in the general case, with errors if you are in the "HEAD shot" mode) or:
$ git rev-parse --symbolic-full-name HEAD
refs/heads/1.8.x
( , " ": refs/heads/, ).
" " 1.8.x?
$ git rev-parse --symbolic-full-name '@{upstream}'
refs/remotes/origin/1.8.x
( , " ", refs/remotes/, ) :
$ git config --get branch.1.8.x.remote
origin
$ git config --get branch.1.8.x.merge
refs/heads/1.8.x
$ git config --get remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*
( git @{upstream} - , fetch 1 ).
?
$ git rev-list --count origin/1.8.x..1.8.x
4
$ git rev-list --count 1.8.x..origin/1.8.x
0
, git rev-list , 1.8.x ( ), origin/1.8.x ( ). 4, " 4". git rev-list , origin/1.8.x, 1.8.x. 0, " 0", git status .
git status , " ". git branch --set-upstream-to - , origin/1.8.x dev/1.8.x - , git status. ( , .)
, , " git status", " ", dev/1.8.x. script, , , B rmt/B rmt ( ). , zog, bob, rev-list bob/zog..zog zog..bob/zog.
1 git config --get-all remote.origin.fetch , ref-mapping fetch. - ; , git plumbing, .