Get tag hash

I am working on a “big” project and has several tags.

Regularly, tarballs are generated and stored with the last hash in their name (not the best practice, but how it rolls).

The following need appeared: we would like to download from our server the tarball identified for tags/v1.0.0 .

Now the question is: how can I get the hash of this tag without cloning the entire project?

EDIT (OP): The question is unclear. I do not want to download the project, because it is large, and the only piece of information that I want is a tag hash.

+5
source share
1 answer

When you are trying to get some information, you can use ls-remote .

In your scenario, you would run 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 cripple into something useful :)

<remote> is the remote you are requesting. A full example with another link to get the sha of the master branch would be:

git ls-remote ssh:// git@github.com /praqma-training/gitkatas refs/heads/master

with output:

634c33168ee434a10f74e3254c3f5f548f263250 refs/heads/master .

Good luck

+3
source

Source: https://habr.com/ru/post/1274707/


All Articles