How can I diff between my repo and a remote repo that's not origin?

From Viewing Unpushed Git Commits I know how to make diff between a repo on my own and my local commits:

git diff origin/master..HEAD

But, How can I do the same instead of origin using a path/to/github/repo.git ?

  • Can I include other .gitignore file in a .gitignore file? (like #include in c-like languages)
  • How to detach “git gui” started in “Git bash” on Windows?
  • Git flow: Can I publish a feature more than once before I finish the feature?
  • git(hub) remove commit from a merge
  • Git pull rebase - What is it rebasing
  • Trying to add .rvmrc to ignore, its not working
  • git diff https://github.com/malarres/universal.git/GPII-795..HEAD
    

    is returning:

    fatal: Invalid object name 'https'.
    

  • git workflow for public feature branch
  • Github for Windows installing got error “Unable to retrieve application files, Files corrupt in deployment”
  • Can't clone on windows but can clone on linux from Gitlab server
  • Deploy Azure web app with private credentials via Git
  • git push non-master to remote
  • Adding an SSH-key permanently in msysgit windows
  • One Solution collect form web for “How can I diff between my repo and a remote repo that's not origin?”

    How can I do the same instead of origin using a path/to/github/repo.git ?

    git diff https://github.com/malarres/universal.git/GPII-795..HEAD

    That’s not the way git diff works. If you want to diff between your local repo and another repo, you need to do the following:

    1. Add the latter as a remote of the former. Note that nothing prevents you from defining multiple remotes, in addition to origin, within one repository. (You may want to choose a less generic remote name than “other”, though.)

      git remote add other https://github.com/malarres/universal.git/GPII-795
      
    2. Fetch everything from that remote:

      git fetch other
      
    3. Run the appropriate git diff command, for instance,

      git diff other/master..HEAD
      

    If you later want to remove that remote from your repository, you can run

    git remote rm other
    
    Git Baby is a git and github fan, let's start git clone.