How do we run git status for a specific remote?

We have two remotes for our local git repository. One remote is called dev, another is called origin. When we run git statusor git status dev, we get this message:

# On branch 1.8.x
# Your branch is ahead of 'origin/1.8.x' by 4 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

A message tells us about the status of the remote origin. This is not what we want. How to check the status only for the remote dev?

+4
source share
2 answers

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, .

+4

"git log", , .

git log dev/1.8.x..HEAD

git log dev/1.8.x..1.8.x

, :

git log --graph --pretty=oneline dev/1.8.x..HEAD
+2

All Articles