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

Manisha Eleperuma picture Manisha Eleperuma · Oct 4, 2013 · Viewed 91.5k times · Source

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 to get it from the original GIT repo by a CURL command or so.

Eg: I want to get the last commit ID of the git URL https://git.appfactorypreview.wso2.com/history/apiapp.git/.

How?

Answer

Litmus picture Litmus · Oct 4, 2013

try this command

git log --format="%H" -n 1