How to get the last commit ID of a remote repo using curl-like command?

前端 未结 6 868
我寻月下人不归
我寻月下人不归 2020-12-12 19:38

I want to get the last commit ID of the remote git repo.

The command git rev-parse HEAD works for a locally-cloned git repo, but I want

6条回答
  •  忘掉有多难
    2020-12-12 20:24

    my answer would not help the OP because he's not on github, but I think I would mention it anyway because it uses curl, or wget, as the OP requested.

    wget -qO- http://api.github.com/repos/Ghini/ghini.desktop/commits/ghini-1.0

    Ghini is my repo, ghini.desktop is my repository, ghini-1.0 is the branch I'm interested in. Replace them to fit your case.

    the JSON answer is a dictionary, and the OP was interested in its sha field, but it contains a lot more information.

提交回复
热议问题