git ls-remote

The command that connects to a remote and lists the refs, and their commit IDs, that it has right now.

In more detail

Unlike git branch -r, which shows your last recorded view, it asks the remote directly, so it answers what is actually over there. It changes nothing locally, so it is safe to run at any time.

Example

git ls-remote origin

Related terms

Taught in

References