tags:

views:

926

answers:

5
+1  A: 

There is no such thing as "incoming commits" users commit locally and push them. I would open up gitx or gitk(that comes with git) and check out what the repos looks like... I think that will give you a clear view.

use: gitk --all to see.

Joseph Silvashy
Please see my clarified question.
Benjamin Pollack
Ahh, I see what you mean now, Dustin's answer is dead on. thanks for more details.
Joseph Silvashy
A: 

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/master

git diff --stat master origin/master

git diff --numstat master origin/master

git diff --dirstat master origin/master

git diff --shortstat master origin/master

git diff --name-only master origin/master

git diff master origin/master
Netzpirat
question isn't about viewing the diff, it's about visualizing the commits and pull that the user has done.
Joseph Silvashy
True, but I feel as if Netzpirat is close; if this were showing me logs instead of diffs, it'd be perfect.
Benjamin Pollack
+8  A: 

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.

Dustin
Also you might want to use `git diff --stat origin/master` to see the diffstat that `git pull` shows after succesfull merge.
Jakub Narębski
+5  A: 

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

Greg Hewgill
ahh, I like this better than using git log
Joseph Silvashy
A: 

when someone tells you to pull, they will give you the repo URL and a branch (default being master)

I'd just do

git fetch URL branch

followed by one (in decreasing order of preference):

# note 3 dots in next 3 commands
gitk HEAD...FETCH_HEAD
    # shows all commits on both sides since the "fork" point
gitk --cherry-pick HEAD...FETCH_HEAD
    # as above but skips identical patches so you really see the differences
git log --graph --boundary --left-right --cherry-pick HEAD...FETCH_HEAD
    # I have a nice alias for this; it's the text mode eqvt of the above

I also use "tig" sometimes, but this specific usecase (seeing both sides) is not well served by tig.

However, if you bring it down to two dots (which may match your actual question more closely, though I still prefer the 3 dot versions), you can do

tig HEAD..FETCH_HEAD
Sitaram