I am working on a "big" project, and it has several tags.
Regularly, tarballs are generated and saved with the last hash in their name (not the best practice, but it's how it rolls).
The following need has risen: We would like to download from our server the tarball identified for tags/v1.0.0
.
The question is now: how can I get the hash of that tag without cloning the whole project?
EDIT (OP): The question was unclear. I do not want to download the project, as it is big, and the only piece of information I want is the hash of the tag.
When you are trying to get some information you can use ls-remote
.
In your scenario you would do the command:
git ls-remote <remote> refs/tags/v1.0.0
This will output something along the lines of:
e8b29c3c46a59dc59e2a3b22c253860c23a9ea39 refs/tags/v1.0.0
which you should be able to mangle into something useful :)
<remote>
is the remote that you are querying. A complete example with another reference to get the sha of the master branch would be:
git ls-remote ssh://[email protected]/praqma-training/gitkatas refs/heads/master
with output:
634c33168ee434a10f74e3254c3f5f548f263250 refs/heads/master
.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With