0

While in a shallow clone of a single commit, is it possible to diff the current checkout to a remote?

Shallow checkout:

$ git init
$ git remote add origin <some_git_url>
$ git fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin --depth=1 +<commit_hash>:refs/remotes/origin/<commit_hash>
$ git checkout --progress --force refs/remotes/origin/<commit_hash>

show changes doesn't work:

$ git diff remotes/origin/main

I understand why the above doesn't work, are there any ways to diff against the remote, though?

harmstyler
  • 1,381
  • 11
  • 20
  • 1
    I guess you could do a shallow fetch of the remote branch, then you could diff. `gt fetch --depth=1 origin the-branch` – eftshift0 Feb 13 '23 at 18:12

0 Answers0