0

I'm new to git and am having trouble understanding how fetch works. If I understand correctly it makes your local repo match the remote repo.

I can't find any evidence of the fetch in $ git log. I see the most recent commit I made at the top of the git log but not the fetch, why is that? Shouldn't I see information regarding the fetch in git log?

How can I get information about the most recent fetch and how can I diff local repo prior to the fetch against the fetch?

user784637
  • 15,392
  • 32
  • 93
  • 156
  • You may be confusing ``fetch`` with ``pull``. A fetch just updates your references to the remote repositories, a pull merges them. You can see those differences by running ``git diff origin/master`` (to see the diffs between your current HEAD and origin/master). – Nick Tomlin Aug 29 '13 at 16:09
  • 1
    `git` doesn't log any information about fetches. – twalberg Aug 29 '13 at 16:15

1 Answers1

0

Using fetch you can evaluate code without actually merging it into your code base. This is used to advantage for people that need to approve a pull request, for example. It can also be used to advantage to avoid "merge commits" where you can fetch a commit and then rebase it or merge it into your work.

This answer may be what you are looking for in detail.

Community
  • 1
  • 1
vgoff
  • 10,980
  • 3
  • 38
  • 56