Home > Back-end >  How to get remote git repo tag's commit message
How to get remote git repo tag's commit message

Time:03-02

I can have a remote repository's hash by tag v0.94.9

git ls-remote https://github.com/status-im/status-go v0.94.9

How to get the commit message for this tag? I do not want to clone that repository, just get its commit message for that tag v0.94.9

CodePudding user response:

Provide a solution that GitHub only (using GitHub APIs):

#!/bin/bash
url=$(curl https://api.github.com/repos/status-im/status-go/git/ref/tags/v0.94.9 | jq -r .object.url)
curl "$url" | jq -r .message

TODO: An answer that using the Smart HTTP(S) protocol:

#!/bin/bash
commit=$(curl -s --output - "https://github.com/status-im/status-go/info/refs?service=git-upload-pack" | grep -a "v0.94.9" | awk '{print $1}' | cut -b 5- -)
# need help for pack-protocol implementation with curl
  •  Tags:  
  • git
  • Related