How can I see incoming commits in git? [duplicate] How can I see incoming commits in git? [duplicate] git git

How can I see incoming commits in git? [duplicate]


incoming isn't quite a direct mapping in git because you can (and I often do) have multiple repos you're pulling from, and each repo has multiple branches.

If there were an equivalent of hg's incoming command, it'd probably be this:

git fetch && git log ..origin/master

That is, "go grab all of the stuff from the upstream, and then compare my current branch against the upstream master branch."

Similarly, outgoing would be this:

git fetch && git log origin/master..

In practice, I just type those manually (even though I created an alias for one of them) because it's easy to have lots of local branches tracking and being tracked by lots of remote branches and have no trouble keeping it together.


You may also be interested in git whatchanged which gives a good overview of changes that have been made in some range of commits.

If you want to review what you're about to pull, do a git fetch first, which only updates local tracking branches for the remote repository (and not any of your branches), and then use any command that shows you the new commits that you're about to pull. For example:

git whatchanged ..origin

This is shorthand for showing the commits between "the common ancestor of wherever I am now and origin" through "origin".


You may want to examine the difference between two repositories. Assumed you have a local branch 'master' and a remote-tracking branch 'origin/master', where other people commit their code, you can get different stats about the differences of the two branches:

git diff --summary master origin/mastergit diff --stat master origin/mastergit diff --numstat master origin/mastergit diff --dirstat master origin/mastergit diff --shortstat master origin/mastergit diff --name-only master origin/mastergit diff master origin/master