5

I use the git status command to find out what I changed locally in my git working directory. But is there an "opposite" of that command?

What I mean is I would like to find out what others have checked in to my remote/tracking branch (I am not sure if remote branch is same as tracking branch, in git) but these changes are not here in my working directory.

Ryan Kohn
  • 13,079
  • 14
  • 56
  • 81
n179911
  • 19,547
  • 46
  • 120
  • 162
  • 2
    My first thought was, "You want to know *less* about your branch? Try smoking weed or something..." – T.E.D. Jul 24 '09 at 17:41

2 Answers2

10

As mentioned in the question "How to get the changes on a branch in git"

git log HEAD..branch

could be what you are looking for here.

        x---y---z---branch
        /
---a---b---c---d---e---HEAD

It would return x, y, z. Note: only two dots, not three here: HEAD..branch.

As mentioned in this other question:

This is identical to git log branch --not HEAD, and means "all commits on branch that aren't on HEAD"

Note: you need a git fetch first, in order to update your local copy of a remote branch. Without that, you would not pick any new modification on the remote branch.


Note: a tracking branch is a local branch that is connected to a remote branch. When you push and pull on that branch, it automatically pushes and pulls to the remote branch that it is connected with.

When you clone a repository, Git only creates a branch corresponding to the remote's master. For each other branch that exists at the remote that you wish to work on locally, you need to create a local branch to track the remote branch.

A patch could be in the making (June 2009 for the patch proposition) to add to git remote command the 'tracking' option, with (this is not a definitive description, but still a work in progress)

git remote tracking <remote> <remote branch>

would show all local branches that track <remote branch>, and have <remote> as default remote, while

git remote tracking <local branch>

would show <remote> and <remote branch> if <local branch> is following remote-tracking branch.

I do not see this feature in the upcoming Git1.6.4 though.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

It seems you are looking for the "git log" command..check the man page here

this question in SO may also help

Community
  • 1
  • 1
Ric Tokyo
  • 6,577
  • 3
  • 30
  • 48