I didn't want to lose some information after a git pull
, so I did a git fetch
before. Where can I read the new modifications after a git fetch
? I went to the FETCH_HEAD
file, but there was nothing more than a big number.

- 965
- 1
- 11
- 30

- 11,279
- 21
- 61
- 85
-
3Do you have access to `gitk`? If you do, run `gitk --all` to view the current state of all your branches on your local machine, even those branches updated by the fetch. – creemama May 21 '12 at 01:04
-
try `git show object` where object is the big hashed number... – Prince John Wesley May 21 '12 at 01:06
-
gitk command works but not gitk all. (By the way, i didn't precise that the remote repository was not changed by me ). In the gitk window, there's no file which indicates the fetched datas – epsilones May 21 '12 at 01:08
-
Thanks the git show command did work fine !! Best, Newben – epsilones May 21 '12 at 01:15
4 Answers
git fetch origin
by default fetches everything from the remote named "origin" and updates (or creates) the so-called "remote-tracking branches" for that remote. Say, for the remote named "origin" which contain branches named "master" and "feature", running git fetch remote
will result in the remote-tracking branches named "origin/master" and "origin/feature" being updated (or created, if they're not exist). You could see them in the output of git branch -a
(notice "-a").
Now, the usual Git setup is that (some of) your local branches follow certain remote branches (usually same-named). That is, your local "master" branch follows "origin/master" etc.
So, after you fetched, to see what remote "master" has compared to your local "master", you ask Git to show you exactly this:
git log origin/master ^master
which means «all commits reachable from "origin/master" which do not include commits reachable from "master"» or, alternatively
git log master..origin/master
which has the same meaning. See the "gitrevisions" manual page for more info, especially the "Specifying ranges" part. Also see the examples in the git-log manual page
You're free to customize the output of git log
as you see fit as it supports a whole lot of options affecting it.
Note that your local branch might also have commits which the matching remote branch does not contain (yet). To get an overview of them you have to reverse the revisions passed to git log
for (hopefully) obvious reasons.
As usual, it's essential to educate yourself to understand the underlying concepts before starting to use a tool. Please do.

- 25,071
- 21
- 34
- 43

- 51,517
- 14
- 93
- 176
-
17Any reason that `git diff master origin/master` wasn't mentioned? It seems to address the OP's question very simply...? (I'm newish to Git and learning so please correct me if wrong.) – Howiecamp Aug 08 '16 at 23:26
-
4@Howiecamp: that produces different results if you've added commits to *your* `master` that you did not get from *their* `master` (your now-updated `origin/master`). It's not a *wrong* thing to do, but it won't show you the *commits they have that you don't* (have on your `master`), while the `git log` will do exactly that. – torek Jun 16 '18 at 16:04
If you just want to see what files will be modified if you do a GIT PULL, do this:
git fetch && git diff HEAD @{u} --name-only
If you want to see ALL differences between your current version and the incoming version, including uncommited local modifications, type this:
git fetch && git diff @{u} --name-only

- 3,170
- 1
- 14
- 27
-
1I had the same question and I found the answer here: https://stackoverflow.com/questions/19474577/what-does-the-argument-u-mean-in-git. In short: `It is a shortcut to refer to the upstream branch which the current branch is tracking` – Lunfel Apr 19 '20 at 01:12
Try
git log --oneline --decorate origin/master
This will give you the change log from the master
head of the origin
remote (you can substitute any other remote branch as needed). You'll get an output somewhat like this:
234121 (origin/master) Commit message 5
872373 Commit message 4
623748 Commit message 3
235090 (master) Commit message 2
192399 Commit message 1
The commit marked (master)
is the head of your local master
branch. The commit marked (origin/master)
is the head of the remote's master
branch.

- 17,296
- 2
- 61
- 80
-
5
-
This shows more commits than only the ones made after I merged my current local head last time. Were there changes how *git log* works? – Bernhard Döbler Feb 12 '21 at 18:16
I mostly do git log origin/master
to see the log of remote repo.
You can compare changes like git diff master origin/master
which will compare the changes of the master branch with your master branch in remote repo.