git - Get the hash of the current HEAD of a repo using only HTTP -
i know if have git repo checked out, can use git
cli current commit hash. there way on http, without cloning repo?
for example, let's want current hash of https://github.com/jashkenas/coffeescript. manually, can go page, press y
on keyboard, , see hash (at time of writing) 1f197fcc1bf1a15bc45a6b23fb3f706ffcb77025
. means if @ later point wanted download coffeescript source @ moment, download https://github.com/jashkenas/coffeescript/archive/1f197fcc1bf1a15bc45a6b23fb3f706ffcb77025.zip , give me source.
is there way using http (e.g. curl)? can hit endpoint tell me current hash of default branch? generalizing bit, there endpoints tell me hash of
- the head of default branch,
- the head of given branch, or
- a particular tag?
if wanted information on github specifically, retrieve using the github api, return large json structure exhaustive information on state of branch:
https://api.github.com/repos/jashkenas/coffeescript/branches/master
(or remove branch name more terse listing of branches , heads.)
for git repositories hosted on other web services, it's possible fetch resource /info/refs
under repository (e.g, http://example.com/repo.git/info/refs
) listing of branches, e.g.:
2aae6c35c94fcfb415dbe95f408b9ce91ee846ed refs/heads/master
however, this not available on github, because github disabled "dumb" http transport in 2011 performance reasons. replacement "smart" transport, while far superior git's own use, isn't usable outside context.
Comments
Post a Comment