I have a local repo, and this repo has a remote. I want to know which commit (by SHA number) is checked out on the remote, assuming the remote is not a bare repository.
Clarification: I don't want anything to do with tracking branches or any other kind of branches on my local repository. In fact I want a method that works even if my local repository is a bare repository. Imagine that my remote is
git rev-parse HEAD
git ls-remote origin HEAD
(any repo reference will do for origin, you can used a url or a path)