0

I have a file in my local repo that I want to compare against a new version of the same file in another repo. I tried to do something like:

git diff origin/master https://github.com/ProjextX/prox.git client/src/main/ber/mainCode.java

but gave me fatal: Invalid object name 'https'

The file in prox.git is located in the same directory client/src/main/ber

Is the command that I'm using correct? If not, what is the best command to compare?

Nasser
  • 2,118
  • 6
  • 33
  • 56
  • 2
    Possible duplicate of [git diff between cloned and original remote repository](http://stackoverflow.com/questions/5162800/git-diff-between-cloned-and-original-remote-repository) - as the answer to that question says you can add any remote you want it doesn't need to be the original where the local copy came from – Matti Lyra Feb 20 '17 at 16:11

1 Answers1

1

In git only three commands could interact with remote repos: fetch/pull/push. So, to use diff you should first download remote repo data locally and then proceed as usual. You could add a new "remote" as per link in a comment, or you could just fetch it into a default ref-name FETCH_HEAD:

git fetch https://github.com/ProjextX/prox.git

and then you could do as usual you do diffs between branches locally

git diff origin/master FETCH_HEAD client/src/main/ber/mainCode.java
kan
  • 28,279
  • 7
  • 71
  • 101