Git: Compare All Local Commits to Remote Repo Version

Ian Dallas picture Ian Dallas · Apr 20, 2011 · Viewed 48.6k times · Source

I'm somewhat new to Git and what I'm trying to do seems like it should be possible. Basically I've been working off of clone of a repo and have made quite a few local commits. Is there a way to see the diff of the 'sum' of all my changes and the original repo version? I would assume this would be possible because Git will essentially do this when I do a push.

Here is an example of what I'm trying to do: in gitk I will see something like this:
* - [mybranch] Added '42' to end of answers.txt (local commit)
* - Added 'Hello World' to end of my.txt (local commit)
* - Added 'C#/.NET' to beginning of my.txt (local commit)
* - <[RemoteRepo]> (original repo I cloned from)

How is it I can view the difference of the sum of all my changes to my.txt and answers.txt when compared to the original version I checked out from RemoteRepo?

Answer

manojlds picture manojlds · Apr 20, 2011

There are three ways ( two others from other answers given here )

1) git diff origin/master master
2) git diff origin/master..master
3) git diff origin/master...master

First one and second one are same and show changes between the tips of the master and remote master.

Third one shows changes that occurred on the master since branch last push and I think this is the most appropriate one you are looking for