Search code examples
gitgit-diffgit-fetch

Git fetch but no diff between local and remote


I have some issue with git diff command. I know HEAD in the remote and on the local don't point to the same commit. Remote has received some more commits. But when I run git fetch and then git diff HEAD...origin, or git diff HEAD...origin/master, or git log -p HEAD..origin, I have no diff shown. Someone has an idea ?


Solution

  • You're using the wrong operator to define the diff endpoints (confer this answer). You can use git diff origin/master to see a diff between your currently checked out commit (HEAD) and origin/master, or you can see a list of commits with git log --all HEAD..origin/master.

    Using "origin" as a commit descriptor as you tried will produce an error (it is not a commit'ish or tree'ish reference), or it might be implicitly resolved, which you should avoid to get the exact results you want.