From any directory, you can use git ls-remote
:
C:\Users\VonC\>git ls-remote https://github.com/git/git master
e230c568c4b9a991e3175e5f65171a566fd8e39c refs/heads/master
4b5eac7f03f411f75087e0b6db23caa999624304 refs/remotes/github/master
4b5eac7f03f411f75087e0b6db23caa999624304 refs/remotes/origin/master
C:\Users\VonC\>git ls-remote https://github.com/git/git HEAD
e230c568c4b9a991e3175e5f65171a566fd8e39c HEAD
4b5eac7f03f411f75087e0b6db23caa999624304 refs/remotes/origin/HEAD
You can see that way the SHA1 of the refspecs including the ref you are interesting in.
The examples above list the SHA1 of refspecs including 'master
' or 'HEAD
'
You can see the HEAD
of the repo 'git' is 4b5eac7... and it corresponds to heads/master
(which means the HEAD of that remote repo is the master
branch)
No cloning was needed for that command to work.