cateyes
cateyes

Reputation: 6198

Retrieve the full commit hash from the remote using a short hash

Say, i have and only know a short commit hash c4cde4c4 which is in the remote repo. It hasn't been fetched into my local yet. Is there a way to retrieve the full commit hash for c4cde4c4 by using git commands either on the client side or the remote git server side? (Don't tell me to fetch it. It's not my question)

Note, git rev-parse c4cde4c4 won't work on the client side in this case, unless c4cde4c4 has been fetched into local. It just returns the following:

fatal: ambiguous argument 'c4cde4c4': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

c4cde4c4

Upvotes: 1

Views: 519

Answers (1)

j6t
j6t

Reputation: 13582

This is not possible by design.

If you do not want to fetch, you have to log in to the remote server (your question does imply that you can issue git commands on the remote server side) and run git rev-parse c4cde4c4 there.

Upvotes: 3

Related Questions