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 originRelated terms
- remote — A short name saved in a repository's config that stands for another repository's location, a URL or a path, so you can fetch from and push to it.
- ref — A Git name that points at a commit, such as a branch (refs/heads/main) or a tag (refs/tags/v1.0).
Taught in
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows