Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opposite of 'git status' command

Tags:

git

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.

like image 575
n179911 Avatar asked Jul 24 '09 16:07

n179911


1 Answers

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.

like image 138
VonC Avatar answered Oct 22 '22 22:10

VonC