threads / discuss / 16123

Git remote status

Subject: Git remote status

## tl;dr

3 messages between Nov 1, 2008 and Nov 2, 2008.

replies: 2people: 3as markdown or json

Gonsolo· Nov 1, 2008, 19:52 UTC · lore
Hi!

If I switch branches with "git checkout master" git tells me something like "Your branch is ahead of the tracked remote branch 'origin/master' by 39 commits". Is there a "git remote status" or git-status switch to get the same information without switching branches? Sometimes it's valuable whether one should push changes (for example before installing a new Ubuntu version ;) ).

Thank you,
g
Miklos Vajna· Nov 1, 2008, 20:11 UTC · re: Gonsolo · lore

Re: Git remote status

On Sat, Nov 01, 2008 at 08:52:48PM +0100, Gonsolo <gonsolo@gmail.com> wrote:
> Is there a "git remote status" or git-status switch to get the same 
> information without switching branches?
Just 'git checkout' should print the info for the current branch.
Jeff King· Nov 2, 2008, 03:30 UTC · re: Gonsolo · lore

Re: Git remote status

On Sat, Nov 01, 2008 at 08:52:48PM +0100, Gonsolo wrote:
Show 5 quoted lines
> If I switch branches with "git checkout master" git tells me something  
> like "Your branch is ahead of the tracked remote branch 'origin/master'  
> by 39 commits".
> Is there a "git remote status" or git-status switch to get the same  
> information without switching branches?

"git status" will do this automatically in recent versions of git (as of 1.6.0, I believe).

You can also use "git branch -v" to see a summary of how all branches relate to their tracked counterparts.

> Sometimes it's valuable whether one should push changes (for example  
> before installing a new Ubuntu version ;) ).
For that, I might want to actually _see_ the changes. So I would use:
  git shortlog origin/master..

(or "log" with a variety of formatting options to get as much information as you like). And if the relationship is more complex (i.e., I want to see if I need to push _or_ pull):

  gitk origin/master...
-Peff

← back to recent threads