If U is a git URL (e.g., an ssh URL), how can I find the SHA1 hash of a branch or tag of U without a local clone of U?
Background. At its core, the Git version control system is a content addressable filesystem. It uses the SHA-1 hash function to name content.
You can get heads (branches) and tags with git ls-remote U
.
You can use this:
git ls-remote U branch | cut -c1-7
where, 'branch' specifies the commit hash from that particular branch
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